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.
This commit is contained in:
bubnikv 2017-09-12 10:14:24 +02:00
parent 888a904c9b
commit 6d4ec5c989

View File

@ -1041,16 +1041,15 @@ sub InitGL {
# Set antialiasing/multisampling # Set antialiasing/multisampling
glDisable(GL_LINE_SMOOTH); glDisable(GL_LINE_SMOOTH);
glDisable(GL_POLYGON_SMOOTH); glDisable(GL_POLYGON_SMOOTH);
if ($self->{can_multisample}) {
# See "GL_MULTISAMPLE and GL_ARRAY_BUFFER_ARB messages on failed launch" # See "GL_MULTISAMPLE and GL_ARRAY_BUFFER_ARB messages on failed launch"
# https://github.com/alexrj/Slic3r/issues/4085 # https://github.com/alexrj/Slic3r/issues/4085
$self->{can_multisample} = 0; eval {
eval { # Disable the multi sampling by default, so the picking by color will work correctly.
glEnable(GL_MULTISAMPLE); glDisable(GL_MULTISAMPLE);
# glHint(GL_MULTISAMPLE_FILTER_HINT_NV, GL_NICEST); };
$self->{can_multisample} = 1; # Disable multi sampling if the eval failed.
} $self->{can_multisample} = 0 if $@;
}
# ambient lighting # ambient lighting
glLightModelfv_p(GL_LIGHT_MODEL_AMBIENT, 0.3, 0.3, 0.3, 1); glLightModelfv_p(GL_LIGHT_MODEL_AMBIENT, 0.3, 0.3, 0.3, 1);