From 6d4ec5c989851e442d58f896d4b0324129e7514a Mon Sep 17 00:00:00 2001 From: bubnikv Date: Tue, 12 Sep 2017 10:14:24 +0200 Subject: [PATCH] Further fix of https://github.com/alexrj/Slic3r/issues/4085 making it safe in case wxWidgets do not report supporting multisampling, but the OpenGL context actually does and it leaves the multi-sampling enabled. This then may in theory lead to incorrect picking by color. --- lib/Slic3r/GUI/3DScene.pm | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/Slic3r/GUI/3DScene.pm b/lib/Slic3r/GUI/3DScene.pm index e0a546695..bb77ebd57 100644 --- a/lib/Slic3r/GUI/3DScene.pm +++ b/lib/Slic3r/GUI/3DScene.pm @@ -1041,16 +1041,15 @@ sub InitGL { # Set antialiasing/multisampling glDisable(GL_LINE_SMOOTH); glDisable(GL_POLYGON_SMOOTH); - if ($self->{can_multisample}) { - # See "GL_MULTISAMPLE and GL_ARRAY_BUFFER_ARB messages on failed launch" - # https://github.com/alexrj/Slic3r/issues/4085 - $self->{can_multisample} = 0; - eval { - glEnable(GL_MULTISAMPLE); -# glHint(GL_MULTISAMPLE_FILTER_HINT_NV, GL_NICEST); - $self->{can_multisample} = 1; - } - } + + # See "GL_MULTISAMPLE and GL_ARRAY_BUFFER_ARB messages on failed launch" + # https://github.com/alexrj/Slic3r/issues/4085 + eval { + # Disable the multi sampling by default, so the picking by color will work correctly. + glDisable(GL_MULTISAMPLE); + }; + # Disable multi sampling if the eval failed. + $self->{can_multisample} = 0 if $@; # ambient lighting glLightModelfv_p(GL_LIGHT_MODEL_AMBIENT, 0.3, 0.3, 0.3, 1);