From e6483689345cd7563c80321d56fb2b1b67abc7d3 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Tue, 25 May 2021 12:09:40 +0200 Subject: [PATCH] Removed unneeded calls to GL_LIGHTING --- src/slic3r/GUI/Gizmos/GLGizmoBase.cpp | 6 ------ src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp | 3 --- src/slic3r/GUI/Gizmos/GLGizmoMove.cpp | 6 ------ src/slic3r/GUI/Gizmos/GLGizmoRotate.cpp | 6 ------ src/slic3r/GUI/Selection.cpp | 5 ----- 5 files changed, 26 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoBase.cpp b/src/slic3r/GUI/Gizmos/GLGizmoBase.cpp index 8e7c4398e..cd05cba04 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoBase.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoBase.cpp @@ -56,9 +56,6 @@ void GLGizmoBase::Grabber::render(float size, const std::array& render { float fullsize = 2 * (dragging ? get_dragging_half_size(size) : get_half_size(size)); - if (! picking) - glsafe(::glEnable(GL_LIGHTING)); - GLShaderProgram* shader = picking ? nullptr : wxGetApp().get_current_shader(); if (shader) shader->set_uniform("uniform_color", render_color); @@ -73,9 +70,6 @@ void GLGizmoBase::Grabber::render(float size, const std::array& render glsafe(::glScaled(fullsize, fullsize, fullsize)); cube.render(); glsafe(::glPopMatrix()); - - if (! picking) - glsafe(::glDisable(GL_LIGHTING)); } diff --git a/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp b/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp index 515e0ea76..486d945ba 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp @@ -178,9 +178,6 @@ void GLGizmoHollow::render_points(const Selection& selection, bool picking) cons glsafe(::glPopMatrix()); } - //if (!picking) - // glsafe(::glDisable(GL_LIGHTING)); - glsafe(::glPopMatrix()); } diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMove.cpp b/src/slic3r/GUI/Gizmos/GLGizmoMove.cpp index 2385b5e5d..8e0cd1366 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMove.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMove.cpp @@ -203,9 +203,6 @@ void GLGizmoMove3D::render_grabber_extension(Axis axis, const BoundingBoxf3& box color[3] = color[3]; } - if (!picking) - glsafe(::glEnable(GL_LIGHTING)); - glsafe(::glColor4fv(color.data())); glsafe(::glPushMatrix()); glsafe(::glTranslated(m_grabbers[axis].center(0), m_grabbers[axis].center(1), m_grabbers[axis].center(2))); @@ -218,9 +215,6 @@ void GLGizmoMove3D::render_grabber_extension(Axis axis, const BoundingBoxf3& box glsafe(::glScaled(0.75 * size, 0.75 * size, 3.0 * size)); m_vbo_cone.render(); glsafe(::glPopMatrix()); - - if (!picking) - glsafe(::glDisable(GL_LIGHTING)); } diff --git a/src/slic3r/GUI/Gizmos/GLGizmoRotate.cpp b/src/slic3r/GUI/Gizmos/GLGizmoRotate.cpp index 624cf2b2f..766e8c1a8 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoRotate.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoRotate.cpp @@ -335,9 +335,6 @@ void GLGizmoRotate::render_grabber_extension(const BoundingBoxf3& box, bool pick color[2] = 1.0f - color[2]; } - if (!picking) - glsafe(::glEnable(GL_LIGHTING)); - glsafe(::glColor4fv(color.data())); glsafe(::glPushMatrix()); glsafe(::glTranslated(m_grabbers[0].center(0), m_grabbers[0].center(1), m_grabbers[0].center(2))); @@ -355,9 +352,6 @@ void GLGizmoRotate::render_grabber_extension(const BoundingBoxf3& box, bool pick glsafe(::glScaled(0.75 * size, 0.75 * size, 3.0 * size)); m_cone.render(); glsafe(::glPopMatrix()); - - if (!picking) - glsafe(::glDisable(GL_LIGHTING)); } void GLGizmoRotate::transform_to_local(const Selection& selection) const diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index 5fe6c2c17..3787e15a2 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -1169,7 +1169,6 @@ void Selection::render(float scale_factor) const #if ENABLE_RENDER_SELECTION_CENTER void Selection::render_center(bool gizmo_is_dragging) const { - if (!m_valid || is_empty() || m_quadric == nullptr) if (!m_valid || is_empty()) return; @@ -1177,15 +1176,11 @@ void Selection::render_center(bool gizmo_is_dragging) const glsafe(::glDisable(GL_DEPTH_TEST)); - glsafe(::glEnable(GL_LIGHTING)); - glsafe(::glColor3f(1.0f, 1.0f, 1.0f)); glsafe(::glPushMatrix()); glsafe(::glTranslated(center(0), center(1), center(2))); m_vbo_sphere.render(); glsafe(::glPopMatrix()); - - glsafe(::glDisable(GL_LIGHTING)); } #endif // ENABLE_RENDER_SELECTION_CENTER