Skip to content

Commit

Permalink
Further fix of slic3r/Slic3r#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 committed Sep 12, 2017
1 parent 888a904 commit 6d4ec5c
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions lib/Slic3r/GUI/3DScene.pm
Expand Up @@ -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);
Expand Down

0 comments on commit 6d4ec5c

Please sign in to comment.