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:
authorEnrico Turri <enricoturri@seznam.cz>2019-06-25 10:51:43 +0300
committerEnrico Turri <enricoturri@seznam.cz>2019-06-25 10:51:43 +0300
commit2f806dedc762c1ee810be44820aaff8de8cb5d07 (patch)
treed63a0a3eaf314ad17c02ac400caed8f48ade0f61 /src/slic3r/GUI/GLSelectionRectangle.cpp
parent3d755e1bbe642becb73c9f64910616787eade373 (diff)
Fixed rendering of selection rectangle with perspective camera
Diffstat (limited to 'src/slic3r/GUI/GLSelectionRectangle.cpp')
-rw-r--r--src/slic3r/GUI/GLSelectionRectangle.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/slic3r/GUI/GLSelectionRectangle.cpp b/src/slic3r/GUI/GLSelectionRectangle.cpp
index 327cb1fde..684563bff 100644
--- a/src/slic3r/GUI/GLSelectionRectangle.cpp
+++ b/src/slic3r/GUI/GLSelectionRectangle.cpp
@@ -68,7 +68,8 @@ namespace GUI {
if (!is_dragging())
return;
- float zoom = (float)canvas.get_camera().get_zoom();
+ const Camera& camera = canvas.get_camera();
+ float zoom = (float)camera.get_zoom();
float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f;
Size cnv_size = canvas.get_canvas_size();
@@ -96,6 +97,11 @@ namespace GUI {
glsafe(::glPushMatrix());
glsafe(::glLoadIdentity());
+ // ensure that the rectangle is renderered inside the frustrum
+ glsafe(::glTranslated(0.0, 0.0, -(camera.get_near_z() + 0.5)));
+ // ensure that the overlay fits the frustrum near z plane
+ double gui_scale = camera.get_gui_scale();
+ glsafe(::glScaled(gui_scale, gui_scale, 1.0));
glsafe(::glPushAttrib(GL_ENABLE_BIT));
glsafe(::glLineStipple(4, 0xAAAA));