From 4990558dee1817ce5061d1f6fdb24b012e96f42a Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Wed, 2 Mar 2022 13:28:20 +0100 Subject: [PATCH] Tech ENABLE_GLBEGIN_GLEND_REMOVAL - Fixed a few bugs when the tech is disabled --- src/slic3r/GUI/3DBed.cpp | 25 +++++++------------- src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp | 10 ++++---- src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp | 2 +- 3 files changed, 14 insertions(+), 23 deletions(-) diff --git a/src/slic3r/GUI/3DBed.cpp b/src/slic3r/GUI/3DBed.cpp index 244a802db..4ed054fb9 100644 --- a/src/slic3r/GUI/3DBed.cpp +++ b/src/slic3r/GUI/3DBed.cpp @@ -593,10 +593,7 @@ void Bed3D::render_texture(bool bottom, GLCanvas3D& canvas) if (bottom) glsafe(::glFrontFace(GL_CW)); - unsigned int stride = m_triangles.get_vertex_data_size(); - - GLint position_id = shader->get_attrib_location("v_position"); - GLint tex_coords_id = shader->get_attrib_location("v_tex_coords"); + const unsigned int stride = m_triangles.get_vertex_data_size(); // show the temporary texture while no compressed data is available GLuint tex_id = (GLuint)m_temp_texture.get_id(); @@ -606,22 +603,16 @@ void Bed3D::render_texture(bool bottom, GLCanvas3D& canvas) glsafe(::glBindTexture(GL_TEXTURE_2D, tex_id)); glsafe(::glBindBuffer(GL_ARRAY_BUFFER, m_vbo_id)); - if (position_id != -1) { - glsafe(::glEnableVertexAttribArray(position_id)); - glsafe(::glVertexAttribPointer(position_id, 3, GL_FLOAT, GL_FALSE, stride, (GLvoid*)(intptr_t)m_triangles.get_position_offset())); - } - if (tex_coords_id != -1) { - glsafe(::glEnableVertexAttribArray(tex_coords_id)); - glsafe(::glVertexAttribPointer(tex_coords_id, 2, GL_FLOAT, GL_FALSE, stride, (GLvoid*)(intptr_t)m_triangles.get_tex_coords_offset())); - } + glsafe(::glVertexPointer(3, GL_FLOAT, stride, (const void*)(intptr_t)m_triangles.get_position_offset())); + glsafe(::glEnableClientState(GL_VERTEX_ARRAY)); + + glsafe(::glTexCoordPointer(2, GL_FLOAT, stride, (const void*)(intptr_t)m_triangles.get_tex_coords_offset())); + glsafe(::glEnableClientState(GL_TEXTURE_COORD_ARRAY)); glsafe(::glDrawArrays(GL_TRIANGLES, 0, (GLsizei)m_triangles.get_vertices_count())); - if (tex_coords_id != -1) - glsafe(::glDisableVertexAttribArray(tex_coords_id)); - - if (position_id != -1) - glsafe(::glDisableVertexAttribArray(position_id)); + glsafe(::glDisableClientState(GL_TEXTURE_COORD_ARRAY)); + glsafe(::glDisableClientState(GL_VERTEX_ARRAY)); glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0)); glsafe(::glBindTexture(GL_TEXTURE_2D, 0)); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp index 76e73ab97..768bdec25 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp @@ -1195,11 +1195,11 @@ void TriangleSelectorGUI::render_debug(ImGuiWrapper* imgui) m_varrays[i].init_from(std::move(varrays_data[i])); } #else - for (auto* iva : { &m_iva_enforcers, &m_iva_blockers }) - iva->finalize_geometry(true); - - for (auto& iva : m_iva_seed_fills) - iva.finalize_geometry(true); +// for (auto* iva : { &m_iva_enforcers, &m_iva_blockers }) +// iva->finalize_geometry(true); +// +// for (auto& iva : m_iva_seed_fills) +// iva.finalize_geometry(true); #endif // ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL #if ENABLE_GLINDEXEDVERTEXARRAY_REMOVAL diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp index 47254e4b3..55fc52de7 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp @@ -245,7 +245,7 @@ void GLGizmoSlaSupports::render_points(const Selection& selection, bool picking) m_cylinder.set_color(render_color); #else m_cylinder.set_color(-1, render_color); - if (shader != nu) + if (shader != nullptr) #endif // ENABLE_GLBEGIN_GLEND_REMOVAL shader->set_uniform("emission_factor", 0.5f); for (const sla::DrainHole& drain_hole : m_c->selection_info()->model_object()->sla_drain_holes) {