Unified opengl textures

This commit is contained in:
Enrico Turri 2018-07-18 15:07:52 +02:00
parent b69e23ce73
commit 3fac0d92cd
4 changed files with 501 additions and 220 deletions

View file

@ -540,8 +540,11 @@ double GLVolume::layer_height_texture_z_to_row_id() const
void GLVolume::generate_layer_height_texture(PrintObject *print_object, bool force)
{
GLTexture *tex = this->layer_height_texture.get();
if (tex == nullptr)
//########################################################################################################################################3
LayersTexture *tex = this->layer_height_texture.get();
// GLTexture *tex = this->layer_height_texture.get();
//########################################################################################################################################3
if (tex == nullptr)
// No layer_height_texture is assigned to this GLVolume, therefore the layer height texture cannot be filled.
return;
@ -588,8 +591,11 @@ std::vector<int> GLVolumeCollection::load_object(
};
// Object will have a single common layer height texture for all volumes.
std::shared_ptr<GLTexture> layer_height_texture = std::make_shared<GLTexture>();
//########################################################################################################################################3
std::shared_ptr<LayersTexture> layer_height_texture = std::make_shared<LayersTexture>();
// std::shared_ptr<GLTexture> layer_height_texture = std::make_shared<GLTexture>();
//########################################################################################################################################3
std::vector<int> volumes_idx;
for (int volume_idx = 0; volume_idx < int(model_object->volumes.size()); ++ volume_idx) {
const ModelVolume *model_volume = model_object->volumes[volume_idx];
@ -1580,45 +1586,44 @@ _3DScene::LegendTexture _3DScene::s_legend_texture;
_3DScene::WarningTexture _3DScene::s_warning_texture;
GUI::GLCanvas3DManager _3DScene::s_canvas_mgr;
unsigned int _3DScene::TextureBase::finalize()
{
if ((m_tex_id == 0) && !m_data.empty()) {
// sends buffer to gpu
::glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
::glGenTextures(1, &m_tex_id);
::glBindTexture(GL_TEXTURE_2D, (GLuint)m_tex_id);
::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)m_tex_width, (GLsizei)m_tex_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)m_data.data());
::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1);
::glBindTexture(GL_TEXTURE_2D, 0);
m_data.clear();
}
return (m_tex_width > 0 && m_tex_height > 0) ? m_tex_id : 0;
}
void _3DScene::TextureBase::_destroy_texture()
{
if (m_tex_id > 0)
{
::glDeleteTextures(1, &m_tex_id);
m_tex_id = 0;
m_tex_height = 0;
m_tex_width = 0;
}
m_data.clear();
}
//########################################################################################################################################3
//unsigned int _3DScene::TextureBase::finalize()
//{
// if ((m_tex_id == 0) && !m_data.empty()) {
// // sends buffer to gpu
// ::glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
// ::glGenTextures(1, &m_tex_id);
// ::glBindTexture(GL_TEXTURE_2D, (GLuint)m_tex_id);
// ::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)m_tex_width, (GLsizei)m_tex_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)m_data.data());
// ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
// ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
// ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1);
// ::glBindTexture(GL_TEXTURE_2D, 0);
// m_data.clear();
// }
// return (m_tex_width > 0 && m_tex_height > 0) ? m_tex_id : 0;
//}
//
//void _3DScene::TextureBase::_destroy_texture()
//{
// if (m_tex_id > 0)
// {
// ::glDeleteTextures(1, &m_tex_id);
// m_tex_id = 0;
// m_tex_height = 0;
// m_tex_width = 0;
// }
// m_data.clear();
//}
//########################################################################################################################################3
const unsigned char _3DScene::WarningTexture::Background_Color[3] = { 9, 91, 134 };
const unsigned char _3DScene::WarningTexture::Opacity = 255;
// Generate a texture data, but don't load it into the GPU yet, as the GPU context may not yet be valid.
//########################################################################################################################################3
bool _3DScene::WarningTexture::generate(const std::string& msg)
{
// Mark the texture as released, but don't release the texture from the GPU yet.
m_tex_width = m_tex_height = 0;
m_data.clear();
reset();
if (msg.empty())
return false;
@ -1630,11 +1635,11 @@ bool _3DScene::WarningTexture::generate(const std::string& msg)
// calculates texture size
wxCoord w, h;
memDC.GetTextExtent(msg, &w, &h);
m_tex_width = (unsigned int)w;
m_tex_height = (unsigned int)h;
m_width = (int)w;
m_height = (int)h;
// generates bitmap
wxBitmap bitmap(m_tex_width, m_tex_height);
wxBitmap bitmap(m_width, m_height);
#if defined(__APPLE__) || defined(_MSC_VER)
bitmap.UseAlpha();
@ -1652,38 +1657,107 @@ bool _3DScene::WarningTexture::generate(const std::string& msg)
memDC.SelectObject(wxNullBitmap);
// Convert the bitmap into a linear data ready to be loaded into the GPU.
{
wxImage image = bitmap.ConvertToImage();
image.SetMaskColour(Background_Color[0], Background_Color[1], Background_Color[2]);
wxImage image = bitmap.ConvertToImage();
image.SetMaskColour(Background_Color[0], Background_Color[1], Background_Color[2]);
// prepare buffer
m_data.assign(4 * m_tex_width * m_tex_height, 0);
for (unsigned int h = 0; h < m_tex_height; ++h)
// prepare buffer
std::vector<unsigned char> data(4 * m_width * m_height, 0);
for (int h = 0; h < m_height; ++h)
{
int hh = h * m_width;
unsigned char* px_ptr = data.data() + 4 * hh;
for (int w = 0; w < m_width; ++w)
{
unsigned int hh = h * m_tex_width;
unsigned char* px_ptr = m_data.data() + 4 * hh;
for (unsigned int w = 0; w < m_tex_width; ++w)
{
*px_ptr++ = image.GetRed(w, h);
*px_ptr++ = image.GetGreen(w, h);
*px_ptr++ = image.GetBlue(w, h);
*px_ptr++ = image.IsTransparent(w, h) ? 0 : Opacity;
}
*px_ptr++ = image.GetRed(w, h);
*px_ptr++ = image.GetGreen(w, h);
*px_ptr++ = image.GetBlue(w, h);
*px_ptr++ = image.IsTransparent(w, h) ? 0 : Opacity;
}
}
// sends buffer to gpu
::glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
::glGenTextures(1, &m_id);
::glBindTexture(GL_TEXTURE_2D, (GLuint)m_id);
::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)m_width, (GLsizei)m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data());
::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1);
::glBindTexture(GL_TEXTURE_2D, 0);
return true;
}
//// Generate a texture data, but don't load it into the GPU yet, as the GPU context may not yet be valid.
//bool _3DScene::WarningTexture::generate(const std::string& msg)
//{
// // Mark the texture as released, but don't release the texture from the GPU yet.
// m_tex_width = m_tex_height = 0;
// m_data.clear();
//
// if (msg.empty())
// return false;
//
// wxMemoryDC memDC;
// // select default font
// memDC.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
//
// // calculates texture size
// wxCoord w, h;
// memDC.GetTextExtent(msg, &w, &h);
// m_tex_width = (unsigned int)w;
// m_tex_height = (unsigned int)h;
//
// // generates bitmap
// wxBitmap bitmap(m_tex_width, m_tex_height);
//
//#if defined(__APPLE__) || defined(_MSC_VER)
// bitmap.UseAlpha();
//#endif
//
// memDC.SelectObject(bitmap);
// memDC.SetBackground(wxBrush(wxColour(Background_Color[0], Background_Color[1], Background_Color[2])));
// memDC.Clear();
//
// memDC.SetTextForeground(*wxWHITE);
//
// // draw message
// memDC.DrawText(msg, 0, 0);
//
// memDC.SelectObject(wxNullBitmap);
//
// // Convert the bitmap into a linear data ready to be loaded into the GPU.
// {
// wxImage image = bitmap.ConvertToImage();
// image.SetMaskColour(Background_Color[0], Background_Color[1], Background_Color[2]);
//
// // prepare buffer
// m_data.assign(4 * m_tex_width * m_tex_height, 0);
// for (unsigned int h = 0; h < m_tex_height; ++h)
// {
// unsigned int hh = h * m_tex_width;
// unsigned char* px_ptr = m_data.data() + 4 * hh;
// for (unsigned int w = 0; w < m_tex_width; ++w)
// {
// *px_ptr++ = image.GetRed(w, h);
// *px_ptr++ = image.GetGreen(w, h);
// *px_ptr++ = image.GetBlue(w, h);
// *px_ptr++ = image.IsTransparent(w, h) ? 0 : Opacity;
// }
// }
// }
// return true;
//}
//########################################################################################################################################3
const unsigned char _3DScene::LegendTexture::Squares_Border_Color[3] = { 64, 64, 64 };
const unsigned char _3DScene::LegendTexture::Background_Color[3] = { 9, 91, 134 };
const unsigned char _3DScene::LegendTexture::Opacity = 255;
// Generate a texture data, but don't load it into the GPU yet, as the GPU context may not yet be valid.
//########################################################################################################################################3
bool _3DScene::LegendTexture::generate(const GCodePreviewData& preview_data, const std::vector<float>& tool_colors)
{
// Mark the texture as released, but don't release the texture from the GPU yet.
m_tex_width = m_tex_height = 0;
m_data.clear();
reset();
// collects items to render
auto title = _(preview_data.get_legend_title());
@ -1701,25 +1775,25 @@ bool _3DScene::LegendTexture::generate(const GCodePreviewData& preview_data, con
// calculates texture size
wxCoord w, h;
memDC.GetTextExtent(title, &w, &h);
unsigned int title_width = (unsigned int)w;
unsigned int title_height = (unsigned int)h;
int title_width = (int)w;
int title_height = (int)h;
unsigned int max_text_width = 0;
unsigned int max_text_height = 0;
int max_text_width = 0;
int max_text_height = 0;
for (const GCodePreviewData::LegendItem& item : items)
{
memDC.GetTextExtent(GUI::from_u8(item.text), &w, &h);
max_text_width = std::max(max_text_width, (unsigned int)w);
max_text_height = std::max(max_text_height, (unsigned int)h);
max_text_width = std::max(max_text_width, (int)w);
max_text_height = std::max(max_text_height, (int)h);
}
m_tex_width = std::max(2 * Px_Border + title_width, 2 * (Px_Border + Px_Square_Contour) + Px_Square + Px_Text_Offset + max_text_width);
m_tex_height = 2 * (Px_Border + Px_Square_Contour) + title_height + Px_Title_Offset + items_count * Px_Square;
m_width = std::max(2 * Px_Border + title_width, 2 * (Px_Border + Px_Square_Contour) + Px_Square + Px_Text_Offset + max_text_width);
m_height = 2 * (Px_Border + Px_Square_Contour) + title_height + Px_Title_Offset + items_count * Px_Square;
if (items_count > 1)
m_tex_height += (items_count - 1) * Px_Square_Contour;
m_height += (items_count - 1) * Px_Square_Contour;
// generates bitmap
wxBitmap bitmap(m_tex_width, m_tex_height);
wxBitmap bitmap(m_width, m_height);
#if defined(__APPLE__) || defined(_MSC_VER)
bitmap.UseAlpha();
@ -1732,15 +1806,15 @@ bool _3DScene::LegendTexture::generate(const GCodePreviewData& preview_data, con
memDC.SetTextForeground(*wxWHITE);
// draw title
unsigned int title_x = Px_Border;
unsigned int title_y = Px_Border;
int title_x = Px_Border;
int title_y = Px_Border;
memDC.DrawText(title, title_x, title_y);
// draw icons contours as background
unsigned int squares_contour_x = Px_Border;
unsigned int squares_contour_y = Px_Border + title_height + Px_Title_Offset;
unsigned int squares_contour_width = Px_Square + 2 * Px_Square_Contour;
unsigned int squares_contour_height = items_count * Px_Square + 2 * Px_Square_Contour;
int squares_contour_x = Px_Border;
int squares_contour_y = Px_Border + title_height + Px_Title_Offset;
int squares_contour_width = Px_Square + 2 * Px_Square_Contour;
int squares_contour_height = items_count * Px_Square + 2 * Px_Square_Contour;
if (items_count > 1)
squares_contour_height += (items_count - 1) * Px_Square_Contour;
@ -1752,15 +1826,15 @@ bool _3DScene::LegendTexture::generate(const GCodePreviewData& preview_data, con
memDC.DrawRectangle(wxRect(squares_contour_x, squares_contour_y, squares_contour_width, squares_contour_height));
// draw items (colored icon + text)
unsigned int icon_x = squares_contour_x + Px_Square_Contour;
unsigned int icon_x_inner = icon_x + 1;
unsigned int icon_y = squares_contour_y + Px_Square_Contour;
unsigned int icon_y_step = Px_Square + Px_Square_Contour;
int icon_x = squares_contour_x + Px_Square_Contour;
int icon_x_inner = icon_x + 1;
int icon_y = squares_contour_y + Px_Square_Contour;
int icon_y_step = Px_Square + Px_Square_Contour;
unsigned int text_x = icon_x + Px_Square + Px_Text_Offset;
unsigned int text_y_offset = (Px_Square - max_text_height) / 2;
int text_x = icon_x + Px_Square + Px_Text_Offset;
int text_y_offset = (Px_Square - max_text_height) / 2;
unsigned int px_inner_square = Px_Square - 2;
int px_inner_square = Px_Square - 2;
for (const GCodePreviewData::LegendItem& item : items)
{
@ -1785,7 +1859,7 @@ bool _3DScene::LegendTexture::generate(const GCodePreviewData& preview_data, con
memDC.DrawRectangle(wxRect(icon_x_inner, icon_y + 1, px_inner_square, px_inner_square));
// draw text
memDC.DrawText(GUI::from_u8(item.text), text_x, icon_y + text_y_offset);
memDC.DrawText(GUI::from_u8(item.text), text_x, icon_y + text_y_offset);
// update y
icon_y += icon_y_step;
@ -1794,28 +1868,177 @@ bool _3DScene::LegendTexture::generate(const GCodePreviewData& preview_data, con
memDC.SelectObject(wxNullBitmap);
// Convert the bitmap into a linear data ready to be loaded into the GPU.
{
wxImage image = bitmap.ConvertToImage();
image.SetMaskColour(Background_Color[0], Background_Color[1], Background_Color[2]);
wxImage image = bitmap.ConvertToImage();
image.SetMaskColour(Background_Color[0], Background_Color[1], Background_Color[2]);
// prepare buffer
m_data.assign(4 * m_tex_width * m_tex_height, 0);
for (unsigned int h = 0; h < m_tex_height; ++h)
// prepare buffer
std::vector<unsigned char> data(4 * m_width * m_height, 0);
for (int h = 0; h < m_height; ++h)
{
int hh = h * m_width;
unsigned char* px_ptr = data.data() + 4 * hh;
for (int w = 0; w < m_width; ++w)
{
unsigned int hh = h * m_tex_width;
unsigned char* px_ptr = m_data.data() + 4 * hh;
for (unsigned int w = 0; w < m_tex_width; ++w)
{
*px_ptr++ = image.GetRed(w, h);
*px_ptr++ = image.GetGreen(w, h);
*px_ptr++ = image.GetBlue(w, h);
*px_ptr++ = image.IsTransparent(w, h) ? 0 : Opacity;
}
*px_ptr++ = image.GetRed(w, h);
*px_ptr++ = image.GetGreen(w, h);
*px_ptr++ = image.GetBlue(w, h);
*px_ptr++ = image.IsTransparent(w, h) ? 0 : Opacity;
}
}
// sends buffer to gpu
::glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
::glGenTextures(1, &m_id);
::glBindTexture(GL_TEXTURE_2D, (GLuint)m_id);
::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, (GLsizei)m_width, (GLsizei)m_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, (const void*)data.data());
::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1);
::glBindTexture(GL_TEXTURE_2D, 0);
return true;
}
//// Generate a texture data, but don't load it into the GPU yet, as the GPU context may not yet be valid.
//bool _3DScene::LegendTexture::generate(const GCodePreviewData& preview_data, const std::vector<float>& tool_colors)
//{
// // Mark the texture as released, but don't release the texture from the GPU yet.
// m_tex_width = m_tex_height = 0;
// m_data.clear();
//
// // collects items to render
// auto title = _(preview_data.get_legend_title());
// const GCodePreviewData::LegendItemsList& items = preview_data.get_legend_items(tool_colors);
//
// unsigned int items_count = (unsigned int)items.size();
// if (items_count == 0)
// // nothing to render, return
// return false;
//
// wxMemoryDC memDC;
// // select default font
// memDC.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
//
// // calculates texture size
// wxCoord w, h;
// memDC.GetTextExtent(title, &w, &h);
// unsigned int title_width = (unsigned int)w;
// unsigned int title_height = (unsigned int)h;
//
// unsigned int max_text_width = 0;
// unsigned int max_text_height = 0;
// for (const GCodePreviewData::LegendItem& item : items)
// {
// memDC.GetTextExtent(GUI::from_u8(item.text), &w, &h);
// max_text_width = std::max(max_text_width, (unsigned int)w);
// max_text_height = std::max(max_text_height, (unsigned int)h);
// }
//
// m_tex_width = std::max(2 * Px_Border + title_width, 2 * (Px_Border + Px_Square_Contour) + Px_Square + Px_Text_Offset + max_text_width);
// m_tex_height = 2 * (Px_Border + Px_Square_Contour) + title_height + Px_Title_Offset + items_count * Px_Square;
// if (items_count > 1)
// m_tex_height += (items_count - 1) * Px_Square_Contour;
//
// // generates bitmap
// wxBitmap bitmap(m_tex_width, m_tex_height);
//
//#if defined(__APPLE__) || defined(_MSC_VER)
// bitmap.UseAlpha();
//#endif
//
// memDC.SelectObject(bitmap);
// memDC.SetBackground(wxBrush(wxColour(Background_Color[0], Background_Color[1], Background_Color[2])));
// memDC.Clear();
//
// memDC.SetTextForeground(*wxWHITE);
//
// // draw title
// unsigned int title_x = Px_Border;
// unsigned int title_y = Px_Border;
// memDC.DrawText(title, title_x, title_y);
//
// // draw icons contours as background
// unsigned int squares_contour_x = Px_Border;
// unsigned int squares_contour_y = Px_Border + title_height + Px_Title_Offset;
// unsigned int squares_contour_width = Px_Square + 2 * Px_Square_Contour;
// unsigned int squares_contour_height = items_count * Px_Square + 2 * Px_Square_Contour;
// if (items_count > 1)
// squares_contour_height += (items_count - 1) * Px_Square_Contour;
//
// wxColour color(Squares_Border_Color[0], Squares_Border_Color[1], Squares_Border_Color[2]);
// wxPen pen(color);
// wxBrush brush(color);
// memDC.SetPen(pen);
// memDC.SetBrush(brush);
// memDC.DrawRectangle(wxRect(squares_contour_x, squares_contour_y, squares_contour_width, squares_contour_height));
//
// // draw items (colored icon + text)
// unsigned int icon_x = squares_contour_x + Px_Square_Contour;
// unsigned int icon_x_inner = icon_x + 1;
// unsigned int icon_y = squares_contour_y + Px_Square_Contour;
// unsigned int icon_y_step = Px_Square + Px_Square_Contour;
//
// unsigned int text_x = icon_x + Px_Square + Px_Text_Offset;
// unsigned int text_y_offset = (Px_Square - max_text_height) / 2;
//
// unsigned int px_inner_square = Px_Square - 2;
//
// for (const GCodePreviewData::LegendItem& item : items)
// {
// // draw darker icon perimeter
// const std::vector<unsigned char>& item_color_bytes = item.color.as_bytes();
// wxImage::HSVValue dark_hsv = wxImage::RGBtoHSV(wxImage::RGBValue(item_color_bytes[0], item_color_bytes[1], item_color_bytes[2]));
// dark_hsv.value *= 0.75;
// wxImage::RGBValue dark_rgb = wxImage::HSVtoRGB(dark_hsv);
// color.Set(dark_rgb.red, dark_rgb.green, dark_rgb.blue, item_color_bytes[3]);
// pen.SetColour(color);
// brush.SetColour(color);
// memDC.SetPen(pen);
// memDC.SetBrush(brush);
// memDC.DrawRectangle(wxRect(icon_x, icon_y, Px_Square, Px_Square));
//
// // draw icon interior
// color.Set(item_color_bytes[0], item_color_bytes[1], item_color_bytes[2], item_color_bytes[3]);
// pen.SetColour(color);
// brush.SetColour(color);
// memDC.SetPen(pen);
// memDC.SetBrush(brush);
// memDC.DrawRectangle(wxRect(icon_x_inner, icon_y + 1, px_inner_square, px_inner_square));
//
// // draw text
// memDC.DrawText(GUI::from_u8(item.text), text_x, icon_y + text_y_offset);
//
// // update y
// icon_y += icon_y_step;
// }
//
// memDC.SelectObject(wxNullBitmap);
//
// // Convert the bitmap into a linear data ready to be loaded into the GPU.
// {
// wxImage image = bitmap.ConvertToImage();
// image.SetMaskColour(Background_Color[0], Background_Color[1], Background_Color[2]);
//
// // prepare buffer
// m_data.assign(4 * m_tex_width * m_tex_height, 0);
// for (unsigned int h = 0; h < m_tex_height; ++h)
// {
// unsigned int hh = h * m_tex_width;
// unsigned char* px_ptr = m_data.data() + 4 * hh;
// for (unsigned int w = 0; w < m_tex_width; ++w)
// {
// *px_ptr++ = image.GetRed(w, h);
// *px_ptr++ = image.GetGreen(w, h);
// *px_ptr++ = image.GetBlue(w, h);
// *px_ptr++ = image.IsTransparent(w, h) ? 0 : Opacity;
// }
// }
// }
// return true;
//}
//########################################################################################################################################3
void _3DScene::init_gl()
{
s_canvas_mgr.init_gl();
@ -2223,36 +2446,60 @@ void _3DScene::generate_legend_texture(const GCodePreviewData& preview_data, con
s_legend_texture.generate(preview_data, tool_colors);
}
unsigned int _3DScene::get_legend_texture_width()
{
return s_legend_texture.get_texture_width();
}
unsigned int _3DScene::get_legend_texture_height()
{
return s_legend_texture.get_texture_height();
}
//###################################################################################################################################################
//unsigned int _3DScene::get_legend_texture_width()
//{
// return s_legend_texture.get_texture_width();
//}
//
//unsigned int _3DScene::get_legend_texture_height()
//{
// return s_legend_texture.get_texture_height();
//}
//###################################################################################################################################################
void _3DScene::reset_legend_texture()
{
s_legend_texture.reset_texture();
//###################################################################################################################################################
s_legend_texture.reset();
// s_legend_texture.reset_texture();
//###################################################################################################################################################
}
unsigned int _3DScene::finalize_legend_texture()
//###################################################################################################################################################
unsigned int _3DScene::get_legend_texture_id()
{
return s_legend_texture.finalize();
return s_legend_texture.get_id();
}
unsigned int _3DScene::get_warning_texture_width()
int _3DScene::get_legend_texture_width()
{
return s_warning_texture.get_texture_width();
return s_legend_texture.get_width();
}
unsigned int _3DScene::get_warning_texture_height()
int _3DScene::get_legend_texture_height()
{
return s_warning_texture.get_texture_height();
return s_legend_texture.get_height();
}
//unsigned int _3DScene::finalize_legend_texture()
//{
// return s_legend_texture.finalize();
//}
//###################################################################################################################################################
//###################################################################################################################################################
//unsigned int _3DScene::get_warning_texture_width()
//{
// return s_warning_texture.get_texture_width();
//}
//
//unsigned int _3DScene::get_warning_texture_height()
//{
// return s_warning_texture.get_texture_height();
//}
//###################################################################################################################################################
void _3DScene::generate_warning_texture(const std::string& msg)
{
s_warning_texture.generate(msg);
@ -2260,12 +2507,32 @@ void _3DScene::generate_warning_texture(const std::string& msg)
void _3DScene::reset_warning_texture()
{
s_warning_texture.reset_texture();
//###################################################################################################################################################
s_warning_texture.reset();
// s_warning_texture.reset_texture();
//###################################################################################################################################################
}
unsigned int _3DScene::finalize_warning_texture()
//###################################################################################################################################################
unsigned int _3DScene::get_warning_texture_id()
{
return s_warning_texture.finalize();
return s_warning_texture.get_id();
}
int _3DScene::get_warning_texture_width()
{
return s_warning_texture.get_width();
}
int _3DScene::get_warning_texture_height()
{
return s_warning_texture.get_height();
}
//unsigned int _3DScene::finalize_warning_texture()
//{
// return s_warning_texture.finalize();
//}
//###################################################################################################################################################
} // namespace Slic3r