Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Matena <lukasmatena@seznam.cz>2020-01-31 16:50:37 +0300
committerLukas Matena <lukasmatena@seznam.cz>2020-01-31 16:50:37 +0300
commit378321231f7ec814e5836fe8175d83895e872601 (patch)
tree3ae082884510fccca8364a7d59cb967bd7ee412d /src/slic3r/GUI/GLCanvas3D.cpp
parent61e9cb0f72817b251ec80fcf6c7b9b225aba5e1a (diff)
Fix of tripping glAssert after switching to Preview on Linux/GTK2
(fix suggested and thus approved by @enricoturri1966)
Diffstat (limited to 'src/slic3r/GUI/GLCanvas3D.cpp')
-rw-r--r--src/slic3r/GUI/GLCanvas3D.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp
index 2d1368af3..bab04b2d1 100644
--- a/src/slic3r/GUI/GLCanvas3D.cpp
+++ b/src/slic3r/GUI/GLCanvas3D.cpp
@@ -1712,7 +1712,11 @@ void GLCanvas3D::render()
const Size& cnv_size = get_canvas_size();
#if ENABLE_6DOF_CAMERA
- m_camera.apply_viewport(0, 0, (unsigned int)cnv_size.get_width(), (unsigned int)cnv_size.get_height());
+ // Probably due to different order of events on Linux/GTK2, when one switched from 3D scene
+ // to preview, this was called before canvas had its final size. It reported zero width
+ // and the viewport was set incorrectly, leading to tripping glAsserts further down
+ // the road (in apply_projection). That's why the minimum size is forced to 10.
+ m_camera.apply_viewport(0, 0, std::max(10u, (unsigned int)cnv_size.get_width()), std::max(10u, (unsigned int)cnv_size.get_height()));
#endif // ENABLE_6DOF_CAMERA
if (m_camera.requires_zoom_to_bed)