diff options
author | Vojtech Kral <vojtech@kral.hk> | 2018-10-01 17:48:08 +0300 |
---|---|---|
committer | Vojtech Kral <vojtech@kral.hk> | 2018-10-01 17:48:24 +0300 |
commit | 9021bd07a33c8daf3decbf2ebf85a90909157c89 (patch) | |
tree | c92f1a32ede4d50f32bd7f1e1d2686c653f4737e /src/slic3r/GUI/GLCanvas3DManager.cpp | |
parent | 08c69057516dfb90a83ec17099c545748855dbc8 (diff) |
WIP: Plater
Diffstat (limited to 'src/slic3r/GUI/GLCanvas3DManager.cpp')
-rw-r--r-- | src/slic3r/GUI/GLCanvas3DManager.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/slic3r/GUI/GLCanvas3DManager.cpp b/src/slic3r/GUI/GLCanvas3DManager.cpp index 1fef7ffe9..643171a17 100644 --- a/src/slic3r/GUI/GLCanvas3DManager.cpp +++ b/src/slic3r/GUI/GLCanvas3DManager.cpp @@ -827,6 +827,31 @@ void GLCanvas3DManager::register_action_selectbyparts_callback(wxGLCanvas* canva it->second->register_action_selectbyparts_callback(callback); } +bool GLCanvas3DManager::can_multisample() +{ + int wxVersion = wxMAJOR_VERSION * 10000 + wxMINOR_VERSION * 100 + wxRELEASE_NUMBER; + const AppConfig* app_config = GUI::get_app_config(); + bool enable_multisample = app_config != nullptr + && app_config->get("use_legacy_opengl") != "1" + && wxVersion >= 30003; + + // if multisample is not enabled or supported by the graphic card, remove it from the attributes list + return enable_multisample && wxGLCanvas::IsExtensionSupported("WGL_ARB_multisample"); + // <<< Alternative method: but IsDisplaySupported() seems not to work + // bool return enable_multisample && wxGLCanvas::IsDisplaySupported(attribList); +} + +wxGLCanvas* GLCanvas3DManager::create_wxglcanvas(wxWindow *parent) +{ + int attribList[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 24, WX_GL_SAMPLE_BUFFERS, GL_TRUE, WX_GL_SAMPLES, 4, 0 }; + + if (! can_multisample()) { + attribList[4] = 0; + } + + return new wxGLCanvas(parent, wxID_ANY, attribList); +} + GLCanvas3DManager::CanvasesMap::iterator GLCanvas3DManager::_get_canvas(wxGLCanvas* canvas) { return (canvas == nullptr) ? m_canvases.end() : m_canvases.find(canvas); |