Removed 'Use legacy OpenGL 1.1 rendering' option

This commit is contained in:
Enrico Turri 2019-06-25 09:20:58 +02:00
parent 27cc66eb54
commit 3d755e1bbe
6 changed files with 11 additions and 37 deletions

View file

@ -54,10 +54,9 @@ void AppConfig::set_defaults()
if (get("preset_update").empty()) if (get("preset_update").empty())
set("preset_update", "1"); set("preset_update", "1");
// Use OpenGL 1.1 even if OpenGL 2.0 is available. This is mainly to support some buggy Intel HD Graphics drivers. // remove old 'use_legacy_opengl' parameter from this config, if present
// github.com/prusa3d/PrusaSlicer/issues/233 if (!get("use_legacy_opengl").empty())
if (get("use_legacy_opengl").empty()) erase("", "use_legacy_opengl");
set("use_legacy_opengl", "0");
#if __APPLE__ #if __APPLE__
if (get("use_retina_opengl").empty()) if (get("use_retina_opengl").empty())

View file

@ -198,8 +198,7 @@ void GLCanvas3D::Shader::_reset()
#endif // !ENABLE_TEXTURES_FROM_SVG #endif // !ENABLE_TEXTURES_FROM_SVG
GLCanvas3D::LayersEditing::LayersEditing() GLCanvas3D::LayersEditing::LayersEditing()
: m_use_legacy_opengl(false) : m_enabled(false)
, m_enabled(false)
, m_z_texture_id(0) , m_z_texture_id(0)
, m_model_object(nullptr) , m_model_object(nullptr)
, m_object_max_z(0.f) , m_object_max_z(0.f)
@ -274,12 +273,7 @@ void GLCanvas3D::LayersEditing::select_object(const Model &model, int object_id)
bool GLCanvas3D::LayersEditing::is_allowed() const bool GLCanvas3D::LayersEditing::is_allowed() const
{ {
return !m_use_legacy_opengl && m_shader.is_initialized() && m_shader.get_shader()->shader_program_id > 0 && m_z_texture_id > 0; return m_shader.is_initialized() && m_shader.get_shader()->shader_program_id > 0 && m_z_texture_id > 0;
}
void GLCanvas3D::LayersEditing::set_use_legacy_opengl(bool use_legacy_opengl)
{
m_use_legacy_opengl = use_legacy_opengl;
} }
bool GLCanvas3D::LayersEditing::is_enabled() const bool GLCanvas3D::LayersEditing::is_enabled() const
@ -1253,7 +1247,7 @@ void GLCanvas3D::post_event(wxEvent &&event)
wxPostEvent(m_canvas, event); wxPostEvent(m_canvas, event);
} }
bool GLCanvas3D::init(bool useVBOs, bool use_legacy_opengl) bool GLCanvas3D::init(bool useVBOs)
{ {
if (m_initialized) if (m_initialized)
return true; return true;
@ -1311,7 +1305,6 @@ bool GLCanvas3D::init(bool useVBOs, bool use_legacy_opengl)
return false; return false;
m_use_VBOs = useVBOs; m_use_VBOs = useVBOs;
m_layers_editing.set_use_legacy_opengl(use_legacy_opengl);
// on linux the gl context is not valid until the canvas is not shown on screen // on linux the gl context is not valid until the canvas is not shown on screen
// we defer the geometry finalization of volumes until the first call to render() // we defer the geometry finalization of volumes until the first call to render()

View file

@ -197,7 +197,6 @@ class GLCanvas3D
static const float THICKNESS_BAR_WIDTH; static const float THICKNESS_BAR_WIDTH;
static const float THICKNESS_RESET_BUTTON_HEIGHT; static const float THICKNESS_RESET_BUTTON_HEIGHT;
bool m_use_legacy_opengl;
bool m_enabled; bool m_enabled;
Shader m_shader; Shader m_shader;
unsigned int m_z_texture_id; unsigned int m_z_texture_id;
@ -250,7 +249,6 @@ class GLCanvas3D
void select_object(const Model &model, int object_id); void select_object(const Model &model, int object_id);
bool is_allowed() const; bool is_allowed() const;
void set_use_legacy_opengl(bool use_legacy_opengl);
bool is_enabled() const; bool is_enabled() const;
void set_enabled(bool enabled); void set_enabled(bool enabled);
@ -492,7 +490,7 @@ public:
wxGLCanvas* get_wxglcanvas() { return m_canvas; } wxGLCanvas* get_wxglcanvas() { return m_canvas; }
const wxGLCanvas* get_wxglcanvas() const { return m_canvas; } const wxGLCanvas* get_wxglcanvas() const { return m_canvas; }
bool init(bool useVBOs, bool use_legacy_opengl); bool init(bool useVBOs);
void post_event(wxEvent &&event); void post_event(wxEvent &&event);
void set_as_dirty(); void set_as_dirty();

View file

@ -192,7 +192,6 @@ GLCanvas3DManager::GLInfo GLCanvas3DManager::s_gl_info;
GLCanvas3DManager::GLCanvas3DManager() GLCanvas3DManager::GLCanvas3DManager()
: m_context(nullptr) : m_context(nullptr)
, m_gl_initialized(false) , m_gl_initialized(false)
, m_use_legacy_opengl(false)
, m_use_VBOs(false) , m_use_VBOs(false)
{ {
} }
@ -268,8 +267,7 @@ void GLCanvas3DManager::init_gl()
{ {
glewInit(); glewInit();
const AppConfig* config = GUI::get_app_config(); const AppConfig* config = GUI::get_app_config();
m_use_legacy_opengl = (config == nullptr) || (config->get("use_legacy_opengl") == "1"); m_use_VBOs = s_gl_info.is_version_greater_or_equal_to(2, 0);
m_use_VBOs = !m_use_legacy_opengl && s_gl_info.is_version_greater_or_equal_to(2, 0);
m_gl_initialized = true; m_gl_initialized = true;
if (GLEW_EXT_texture_compression_s3tc) if (GLEW_EXT_texture_compression_s3tc)
s_compressed_textures_supported = true; s_compressed_textures_supported = true;
@ -325,16 +323,14 @@ bool GLCanvas3DManager::init(GLCanvas3D& canvas)
if (!m_gl_initialized) if (!m_gl_initialized)
init_gl(); init_gl();
return canvas.init(m_use_VBOs, m_use_legacy_opengl); return canvas.init(m_use_VBOs);
} }
void GLCanvas3DManager::detect_multisample(int* attribList) void GLCanvas3DManager::detect_multisample(int* attribList)
{ {
int wxVersion = wxMAJOR_VERSION * 10000 + wxMINOR_VERSION * 100 + wxRELEASE_NUMBER; int wxVersion = wxMAJOR_VERSION * 10000 + wxMINOR_VERSION * 100 + wxRELEASE_NUMBER;
const AppConfig* app_config = GUI::get_app_config(); const AppConfig* app_config = GUI::get_app_config();
bool enable_multisample = app_config != nullptr bool enable_multisample = wxVersion >= 30003;
&& app_config->get("use_legacy_opengl") != "1"
&& wxVersion >= 30003;
s_multisample = (enable_multisample && wxGLCanvas::IsDisplaySupported(attribList)) ? MS_Enabled : MS_Disabled; s_multisample = (enable_multisample && wxGLCanvas::IsDisplaySupported(attribList)) ? MS_Enabled : MS_Disabled;
// Alternative method: it was working on previous version of wxWidgets but not with the latest, at least on Windows // Alternative method: it was working on previous version of wxWidgets but not with the latest, at least on Windows

View file

@ -75,7 +75,6 @@ private:
wxGLContext* m_context; wxGLContext* m_context;
static GLInfo s_gl_info; static GLInfo s_gl_info;
bool m_gl_initialized; bool m_gl_initialized;
bool m_use_legacy_opengl;
bool m_use_VBOs; bool m_use_VBOs;
static EMultisampleState s_multisample; static EMultisampleState s_multisample;
static bool s_compressed_textures_supported; static bool s_compressed_textures_supported;

View file

@ -97,16 +97,6 @@ void PreferencesDialog::build()
option = Option (def,"show_incompatible_presets"); option = Option (def,"show_incompatible_presets");
m_optgroup->append_single_option_line(option); m_optgroup->append_single_option_line(option);
// TODO: remove?
def.label = L("Use legacy OpenGL 1.1 rendering");
def.type = coBool;
def.tooltip = L("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 and anti aliasing, so it is likely better to upgrade your graphics driver.");
def.set_default_value(new ConfigOptionBool{ app_config->get("use_legacy_opengl") == "1" });
option = Option (def,"use_legacy_opengl");
m_optgroup->append_single_option_line(option);
#if __APPLE__ #if __APPLE__
def.label = L("Use Retina resolution for the 3D scene"); def.label = L("Use Retina resolution for the 3D scene");
def.type = coBool; def.type = coBool;
@ -150,8 +140,7 @@ void PreferencesDialog::build()
void PreferencesDialog::accept() void PreferencesDialog::accept()
{ {
if (m_values.find("no_defaults") != m_values.end() || if (m_values.find("no_defaults") != m_values.end()) {
m_values.find("use_legacy_opengl") != m_values.end()) {
warning_catcher(this, wxString::Format(_(L("You need to restart %s to make the changes effective.")), SLIC3R_APP_NAME)); warning_catcher(this, wxString::Format(_(L("You need to restart %s to make the changes effective.")), SLIC3R_APP_NAME));
} }