Skip to content

Commit

Permalink
Further fix of #4085
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bubnikv authored and lordofhyphens committed Oct 23, 2017
1 parent 6f72f41 commit 953439a
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions lib/Slic3r/GUI/3DScene.pm
Expand Up @@ -745,16 +745,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);
Expand Down

0 comments on commit 953439a

Please sign in to comment.