diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index 31825d346..5a44ae48e 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -23,6 +23,8 @@ #define ENABLE_MODIFIED_CAMERA_TARGET (1 && ENABLE_1_42_0) // Add Geometry::Transformation class and use it into ModelInstance, ModelVolume and GLVolume #define ENABLE_MODELVOLUME_TRANSFORM (1 && ENABLE_1_42_0) +// Gizmos always rendered on top of objects +#define ENABLE_GIZMOS_ON_TOP (1 && ENABLE_1_42_0) #endif // _technologies_h_ diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 3e405ffe1..24401f7ef 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -2714,8 +2714,6 @@ void GLCanvas3D::Gizmos::render_current_gizmo(const GLCanvas3D::Selection& selec if (!m_enabled) return; - ::glDisable(GL_DEPTH_TEST); - _render_current_gizmo(selection); } @@ -3639,6 +3637,7 @@ void GLCanvas3D::render() _picking_pass(); // draw scene + ::glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); _render_background(); if (is_custom_bed) // untextured bed needs to be rendered before objects @@ -3647,8 +3646,8 @@ void GLCanvas3D::render() // disable depth testing so that axes are not covered by ground _render_axes(false); } - _render_objects(); + _render_objects(); _render_selection(); if (!is_custom_bed) // textured bed needs to be rendered after objects @@ -4972,8 +4971,6 @@ void GLCanvas3D::_picking_pass() const void GLCanvas3D::_render_background() const { - ::glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - ::glPushMatrix(); ::glLoadIdentity(); ::glMatrixMode(GL_PROJECTION); diff --git a/src/slic3r/GUI/GLGizmo.cpp b/src/slic3r/GUI/GLGizmo.cpp index 11e7bfe23..cff60b10c 100644 --- a/src/slic3r/GUI/GLGizmo.cpp +++ b/src/slic3r/GUI/GLGizmo.cpp @@ -631,6 +631,10 @@ void GLGizmoRotate3D::on_stop_dragging() void GLGizmoRotate3D::on_render(const GLCanvas3D::Selection& selection) const { +#if ENABLE_GIZMOS_ON_TOP + ::glClear(GL_DEPTH_BUFFER_BIT); +#endif // ENABLE_GIZMOS_ON_TOP + if ((m_hover_id == -1) || (m_hover_id == 0)) m_gizmos[X].render(selection); @@ -749,6 +753,9 @@ void GLGizmoScale3D::on_render(const GLCanvas3D::Selection& selection) const set_tooltip(tooltip); } +#if ENABLE_GIZMOS_ON_TOP + ::glClear(GL_DEPTH_BUFFER_BIT); +#endif // ENABLE_GIZMOS_ON_TOP ::glEnable(GL_DEPTH_TEST); BoundingBoxf3 box; @@ -1072,6 +1079,9 @@ void GLGizmoMove3D::on_render(const GLCanvas3D::Selection& selection) const else if ((show_position && (m_hover_id == 2)) || m_grabbers[2].dragging) set_tooltip("Z: " + format(show_position ? position(2) : m_displacement(2), 2)); +#if ENABLE_GIZMOS_ON_TOP + ::glClear(GL_DEPTH_BUFFER_BIT); +#endif // ENABLE_GIZMOS_ON_TOP ::glEnable(GL_DEPTH_TEST); const BoundingBoxf3& box = selection.get_bounding_box();