mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-14 02:07:54 -06:00
2nd Attempt to fix texture rendering on OpenGL 1.1 cards
This commit is contained in:
parent
b139f38784
commit
75cd436ae5
3 changed files with 12 additions and 6 deletions
|
@ -397,7 +397,7 @@ void GLVolume::render_using_layer_height() const
|
||||||
GLsizei half_h = h / 2;
|
GLsizei half_h = h / 2;
|
||||||
|
|
||||||
//#######################################################################################################################
|
//#######################################################################################################################
|
||||||
::glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
// ::glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
//#######################################################################################################################
|
//#######################################################################################################################
|
||||||
glBindTexture(GL_TEXTURE_2D, layer_height_texture_data.texture_id);
|
glBindTexture(GL_TEXTURE_2D, layer_height_texture_data.texture_id);
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
|
||||||
|
@ -1586,7 +1586,7 @@ unsigned int _3DScene::TextureBase::finalize()
|
||||||
if (!m_data.empty()) {
|
if (!m_data.empty()) {
|
||||||
// sends buffer to gpu
|
// sends buffer to gpu
|
||||||
//#######################################################################################################################
|
//#######################################################################################################################
|
||||||
::glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
// ::glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
//#######################################################################################################################
|
//#######################################################################################################################
|
||||||
::glGenTextures(1, &m_tex_id);
|
::glGenTextures(1, &m_tex_id);
|
||||||
::glBindTexture(GL_TEXTURE_2D, m_tex_id);
|
::glBindTexture(GL_TEXTURE_2D, m_tex_id);
|
||||||
|
|
|
@ -500,6 +500,7 @@ void GLCanvas3D::Bed::_render_prusa(float theta) const
|
||||||
|
|
||||||
//#######################################################################################################################
|
//#######################################################################################################################
|
||||||
::glEnable(GL_TEXTURE_2D);
|
::glEnable(GL_TEXTURE_2D);
|
||||||
|
::glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||||
//#######################################################################################################################
|
//#######################################################################################################################
|
||||||
|
|
||||||
::glEnableClientState(GL_VERTEX_ARRAY);
|
::glEnableClientState(GL_VERTEX_ARRAY);
|
||||||
|
@ -508,7 +509,9 @@ void GLCanvas3D::Bed::_render_prusa(float theta) const
|
||||||
if (theta > 90.0f)
|
if (theta > 90.0f)
|
||||||
::glFrontFace(GL_CW);
|
::glFrontFace(GL_CW);
|
||||||
|
|
||||||
::glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
//#######################################################################################################################
|
||||||
|
// ::glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
//#######################################################################################################################
|
||||||
::glBindTexture(GL_TEXTURE_2D, (theta <= 90.0f) ? (GLuint)m_top_texture.get_id() : (GLuint)m_bottom_texture.get_id());
|
::glBindTexture(GL_TEXTURE_2D, (theta <= 90.0f) ? (GLuint)m_top_texture.get_id() : (GLuint)m_bottom_texture.get_id());
|
||||||
::glVertexPointer(3, GL_FLOAT, 0, (GLvoid*)m_triangles.get_vertices());
|
::glVertexPointer(3, GL_FLOAT, 0, (GLvoid*)m_triangles.get_vertices());
|
||||||
::glTexCoordPointer(2, GL_FLOAT, 0, (GLvoid*)m_triangles.get_tex_coords());
|
::glTexCoordPointer(2, GL_FLOAT, 0, (GLvoid*)m_triangles.get_tex_coords());
|
||||||
|
@ -988,7 +991,7 @@ void GLCanvas3D::LayersEditing::_render_active_object_annotations(const GLCanvas
|
||||||
GLsizei half_h = h / 2;
|
GLsizei half_h = h / 2;
|
||||||
|
|
||||||
//#######################################################################################################################
|
//#######################################################################################################################
|
||||||
::glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
// ::glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
//#######################################################################################################################
|
//#######################################################################################################################
|
||||||
::glBindTexture(GL_TEXTURE_2D, m_z_texture_id);
|
::glBindTexture(GL_TEXTURE_2D, m_z_texture_id);
|
||||||
::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
|
::glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
|
||||||
|
|
|
@ -74,7 +74,7 @@ bool GLTexture::load_from_file(const std::string& filename, bool generate_mipmap
|
||||||
// sends data to gpu
|
// sends data to gpu
|
||||||
|
|
||||||
//#######################################################################################################################
|
//#######################################################################################################################
|
||||||
::glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
// ::glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
//#######################################################################################################################
|
//#######################################################################################################################
|
||||||
::glGenTextures(1, &m_id);
|
::glGenTextures(1, &m_id);
|
||||||
::glBindTexture(GL_TEXTURE_2D, m_id);
|
::glBindTexture(GL_TEXTURE_2D, m_id);
|
||||||
|
@ -131,13 +131,16 @@ const std::string& GLTexture::get_source() const
|
||||||
|
|
||||||
void GLTexture::render_texture(unsigned int tex_id, float left, float right, float bottom, float top)
|
void GLTexture::render_texture(unsigned int tex_id, float left, float right, float bottom, float top)
|
||||||
{
|
{
|
||||||
::glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
//#######################################################################################################################
|
||||||
|
// ::glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||||
|
//#######################################################################################################################
|
||||||
|
|
||||||
::glDisable(GL_LIGHTING);
|
::glDisable(GL_LIGHTING);
|
||||||
::glEnable(GL_BLEND);
|
::glEnable(GL_BLEND);
|
||||||
::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
//#######################################################################################################################
|
//#######################################################################################################################
|
||||||
::glEnable(GL_TEXTURE_2D);
|
::glEnable(GL_TEXTURE_2D);
|
||||||
|
::glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||||
//#######################################################################################################################
|
//#######################################################################################################################
|
||||||
|
|
||||||
::glBindTexture(GL_TEXTURE_2D, (GLuint)tex_id);
|
::glBindTexture(GL_TEXTURE_2D, (GLuint)tex_id);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue