From 9921945cbf6942ac8f20cce8471f732d93462bbf Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Fri, 17 Apr 2020 11:11:12 +0200 Subject: [PATCH 1/2] Fixed a failing assertion in FDM supports gizmo It was a result of attempting to render an empty GLIndexedVertexArray --- src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp index 7086f3c8d..a8e42053f 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp @@ -101,10 +101,14 @@ void GLGizmoFdmSupports::render_triangles(const Selection& selection) const glsafe(::glPushMatrix()); glsafe(::glMultMatrixd(trafo_matrix.data())); - glsafe(::glColor4f(0.2f, 0.2f, 1.0f, 0.5f)); - m_ivas[mesh_id][0].render(); - glsafe(::glColor4f(1.f, 0.2f, 0.2f, 0.5f)); - m_ivas[mesh_id][1].render(); + + // Now render both enforcers and blockers. + for (int i=0; i<2; ++i) { + if (m_ivas[mesh_id][i].has_VBOs()) { + glsafe(::glColor4f(i ? 1.f : 0.2f, 0.2f, i ? 0.2f : 1.0f, 0.5f)); + m_ivas[mesh_id][i].render(); + } + } glsafe(::glPopMatrix()); } } @@ -448,7 +452,8 @@ void GLGizmoFdmSupports::update_vertex_buffers(const ModelVolume* mv, iva.push_triangle(3*triangle_cnt, 3*triangle_cnt+1, 3*triangle_cnt+2); ++triangle_cnt; } - iva.finalize_geometry(true); + if (iva.has_VBOs()) + iva.finalize_geometry(true); } } From be9dcf0c77d106393b08f961042ea44cd56f8745 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Fri, 17 Apr 2020 14:17:11 +0200 Subject: [PATCH 2/2] Fixup of previous commit --- src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp index a8e42053f..def8cb0f8 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp @@ -452,7 +452,7 @@ void GLGizmoFdmSupports::update_vertex_buffers(const ModelVolume* mv, iva.push_triangle(3*triangle_cnt, 3*triangle_cnt+1, 3*triangle_cnt+2); ++triangle_cnt; } - if (iva.has_VBOs()) + if (! m_selected_facets[mesh_id].empty()) iva.finalize_geometry(true); } }