Fixed a failing assertion in FDM supports gizmo

It was a result of attempting to render an empty GLIndexedVertexArray
This commit is contained in:
Lukas Matena 2020-04-17 11:11:12 +02:00
parent 287e50d091
commit 9921945cbf

View file

@ -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,6 +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())
iva.finalize_geometry(true);
}
}