Workaround for buggy Intel HD Graphics OpenGL drivers:

Fall back to OpenGL 1.1 by a "use_legacy_opengl" preferences switch.
https://github.com/prusa3d/Slic3r/issues/233
https://github.com/prusa3d/Slic3r/issues/268
https://github.com/prusa3d/Slic3r/issues/619
This commit is contained in:
bubnikv 2017-12-11 18:00:51 +01:00
parent 61e6f23ed2
commit 743fc9dbd0
3 changed files with 24 additions and 2 deletions

View file

@ -15,7 +15,7 @@ package Slic3r::GUI::3DScene::Base;
use strict; use strict;
use warnings; use warnings;
use Wx qw(:timer :bitmap :icon :dialog); use Wx qw(wxTheApp :timer :bitmap :icon :dialog);
use Wx::Event qw(EVT_PAINT EVT_SIZE EVT_ERASE_BACKGROUND EVT_IDLE EVT_MOUSEWHEEL EVT_MOUSE_EVENTS EVT_CHAR EVT_TIMER); use Wx::Event qw(EVT_PAINT EVT_SIZE EVT_ERASE_BACKGROUND EVT_IDLE EVT_MOUSEWHEEL EVT_MOUSE_EVENTS EVT_CHAR EVT_TIMER);
# must load OpenGL *before* Wx::GLCanvas # must load OpenGL *before* Wx::GLCanvas
use OpenGL qw(:glconstants :glfunctions :glufunctions :gluconstants); use OpenGL qw(:glconstants :glfunctions :glufunctions :gluconstants);
@ -956,6 +956,16 @@ sub UseVBOs {
my ($self) = @_; my ($self) = @_;
if (! defined ($self->{use_VBOs})) { if (! defined ($self->{use_VBOs})) {
my $use_legacy = wxTheApp->{app_config}->get('use_legacy_opengl');
if ($use_legacy eq '1') {
# Disable OpenGL 2.0 rendering.
$self->{use_VBOs} = 0;
# Don't enable the layer editing tool.
$self->{layer_editing_enabled} = 0;
# 2 means failed
$self->{layer_editing_initialized} = 2;
return 0;
}
# This is a special path for wxWidgets on GTK, where an OpenGL context is initialized # This is a special path for wxWidgets on GTK, where an OpenGL context is initialized
# first when an OpenGL widget is shown for the first time. How ugly. # first when an OpenGL widget is shown for the first time. How ugly.
return 0 if (! $self->init && $^O eq 'linux'); return 0 if (! $self->init && $^O eq 'linux');

View file

@ -72,6 +72,13 @@ sub new {
'if they are marked as incompatible with the active printer', 'if they are marked as incompatible with the active printer',
default => $app_config->get("show_incompatible_presets"), default => $app_config->get("show_incompatible_presets"),
)); ));
$optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new(
opt_id => 'use_legacy_opengl',
type => 'bool',
label => 'Use legacy OpenGL 1.1 rendering',
tooltip => 'If you have rendering issues caused by a buggy OpenGL 2.0 driver, you may try to check this checkbox. This will disable the layer height editing, so it is likely better to upgrade your graphics driver.',
default => $app_config->get("use_legacy_opengl"),
));
my $sizer = Wx::BoxSizer->new(wxVERTICAL); my $sizer = Wx::BoxSizer->new(wxVERTICAL);
$sizer->Add($optgroup->sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10); $sizer->Add($optgroup->sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
@ -90,7 +97,8 @@ sub _accept {
my ($self) = @_; my ($self) = @_;
if (defined($self->{values}{no_controller}) || if (defined($self->{values}{no_controller}) ||
defined($self->{values}{no_defaults})) { defined($self->{values}{no_defaults}) ||
defined($self->{values}{use_legacy_opengl})) {
Slic3r::GUI::warning_catcher($self)->("You need to restart Slic3r to make the changes effective."); Slic3r::GUI::warning_catcher($self)->("You need to restart Slic3r to make the changes effective.");
} }

View file

@ -45,6 +45,10 @@ void AppConfig::set_defaults()
// Version check is enabled by default in the config, but it is not implemented yet. // Version check is enabled by default in the config, but it is not implemented yet.
if (get("version_check").empty()) if (get("version_check").empty())
set("version_check", "1"); set("version_check", "1");
// Use OpenGL 1.1 even if OpenGL 2.0 is available. This is mainly to support some buggy Intel HD Graphics drivers.
// https://github.com/prusa3d/Slic3r/issues/233
if (get("use_legacy_opengl").empty())
set("use_legacy_opengl", "0");
} }
void AppConfig::load() void AppConfig::load()