From 37219fe4f35c129e800b2c6b8b4e90ec70b9fa0a Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Tue, 5 Oct 2021 14:49:18 +0200 Subject: [PATCH] Fixed crash when turning on shells visibility in preview and the application was started with background processing active --- src/slic3r/GUI/GCodeViewer.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index 4a3849af8..fd2fe9cbc 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -3203,6 +3203,14 @@ void GCodeViewer::render_shells() if (shader == nullptr) return; + // when the background processing is enabled, it may happen that the shells data have been loaded + // before opengl has been initialized for the preview canvas. + // when this happens, the volumes' data have not been sent to gpu yet. + for (GLVolume* v : m_shells.volumes.volumes) { + if (!v->indexed_vertex_array.has_VBOs()) + v->finalize_geometry(true); + } + // glsafe(::glDepthMask(GL_FALSE)); shader->start_using();