diff --git a/src/slic3r/GUI/Jobs/CreateFontNameImageJob.cpp b/src/slic3r/GUI/Jobs/CreateFontNameImageJob.cpp index 0defecffc..6bcedffc0 100644 --- a/src/slic3r/GUI/Jobs/CreateFontNameImageJob.cpp +++ b/src/slic3r/GUI/Jobs/CreateFontNameImageJob.cpp @@ -97,16 +97,15 @@ void CreateFontImageJob::finalize(bool canceled, std::exception_ptr &) if (canceled) return; // upload texture on GPU - GLuint tex_id; - GLenum target = GL_TEXTURE_2D, format = GL_ALPHA, type = GL_UNSIGNED_BYTE; - GLint level = 0, border = 0; + const GLenum target = GL_TEXTURE_2D; glsafe(::glBindTexture(target, m_input.texture_id)); GLint w = m_tex_size.x(), h = m_tex_size.y(), xoffset = m_input.size.x() - m_tex_size.x(), // arrange right yoffset = m_input.size.y() * m_input.index; - glsafe(::glTexSubImage2D(target, level, xoffset, yoffset, w, h, format, type, m_result.data())); + glsafe(::glTexSubImage2D(target, m_input.level, xoffset, yoffset, w, h, + m_input.format, m_input.type, m_result.data())); // bind default texture GLuint no_texture_id = 0; diff --git a/src/slic3r/GUI/Jobs/CreateFontNameImageJob.hpp b/src/slic3r/GUI/Jobs/CreateFontNameImageJob.hpp index 5c001fbc9..1e380fc6d 100644 --- a/src/slic3r/GUI/Jobs/CreateFontNameImageJob.hpp +++ b/src/slic3r/GUI/Jobs/CreateFontNameImageJob.hpp @@ -21,6 +21,7 @@ struct FontImageData wxString font_name; wxFontEncoding encoding; // texture for copy result to + // texture MUST BE initialized GLuint texture_id; // Index of face name, define place in texture size_t index; @@ -31,6 +32,10 @@ struct FontImageData // bigger value create darker image // divide value 255 unsigned char gray_level = 5; + + // texture meta data + GLenum format = GL_ALPHA, type = GL_UNSIGNED_BYTE; + GLint level = 0, border = 0; }; ///