mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-17 19:57:55 -06:00
1st attempt to fix opengl on ubuntu
This commit is contained in:
parent
645cc65d2b
commit
5c32347449
9 changed files with 154 additions and 71 deletions
|
@ -114,8 +114,11 @@ std::string GLCanvas3DManager::GLInfo::to_string(bool format_as_html, bool exten
|
|||
}
|
||||
|
||||
GLCanvas3DManager::GLCanvas3DManager()
|
||||
: m_context(nullptr)
|
||||
, m_current(nullptr)
|
||||
//#################################################################################################################
|
||||
: m_current(nullptr)
|
||||
// : m_context(nullptr)
|
||||
// , m_current(nullptr)
|
||||
//#################################################################################################################
|
||||
, m_gl_initialized(false)
|
||||
, m_use_legacy_opengl(false)
|
||||
, m_use_VBOs(false)
|
||||
|
@ -124,8 +127,10 @@ GLCanvas3DManager::GLCanvas3DManager()
|
|||
|
||||
GLCanvas3DManager::~GLCanvas3DManager()
|
||||
{
|
||||
if (m_context != nullptr)
|
||||
delete m_context;
|
||||
//#################################################################################################################
|
||||
// if (m_context != nullptr)
|
||||
// delete m_context;
|
||||
//#################################################################################################################
|
||||
}
|
||||
|
||||
bool GLCanvas3DManager::add(wxGLCanvas* canvas)
|
||||
|
@ -136,14 +141,19 @@ bool GLCanvas3DManager::add(wxGLCanvas* canvas)
|
|||
if (_get_canvas(canvas) != m_canvases.end())
|
||||
return false;
|
||||
|
||||
if (m_context == nullptr)
|
||||
{
|
||||
m_context = new wxGLContext(canvas);
|
||||
if (m_context == nullptr)
|
||||
return false;
|
||||
}
|
||||
//#################################################################################################################
|
||||
// if (m_context == nullptr)
|
||||
// {
|
||||
// m_context = new wxGLContext(canvas);
|
||||
// if (m_context == nullptr)
|
||||
// return false;
|
||||
// }
|
||||
//#################################################################################################################
|
||||
|
||||
GLCanvas3D* canvas3D = new GLCanvas3D(canvas, m_context);
|
||||
//#################################################################################################################
|
||||
GLCanvas3D* canvas3D = new GLCanvas3D(canvas);
|
||||
// GLCanvas3D* canvas3D = new GLCanvas3D(canvas, m_context);
|
||||
//#################################################################################################################
|
||||
if (canvas3D == nullptr)
|
||||
return false;
|
||||
|
||||
|
@ -213,33 +223,35 @@ bool GLCanvas3DManager::init(wxGLCanvas* canvas)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool GLCanvas3DManager::set_current(wxGLCanvas* canvas, bool force)
|
||||
{
|
||||
// given canvas is already current, return
|
||||
if (m_current == canvas)
|
||||
return true;
|
||||
|
||||
if (canvas == nullptr)
|
||||
{
|
||||
m_current = nullptr;
|
||||
return true;
|
||||
}
|
||||
|
||||
// set given canvas as current
|
||||
CanvasesMap::iterator it = _get_canvas(canvas);
|
||||
if (it != m_canvases.end())
|
||||
{
|
||||
bool res = it->second->set_current(force);
|
||||
if (res)
|
||||
{
|
||||
m_current = canvas;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
m_current = nullptr;
|
||||
return false;
|
||||
}
|
||||
//#################################################################################################################
|
||||
//bool GLCanvas3DManager::set_current(wxGLCanvas* canvas, bool force)
|
||||
//{
|
||||
// // given canvas is already current, return
|
||||
// if (m_current == canvas)
|
||||
// return true;
|
||||
//
|
||||
// if (canvas == nullptr)
|
||||
// {
|
||||
// m_current = nullptr;
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// // set given canvas as current
|
||||
// CanvasesMap::iterator it = _get_canvas(canvas);
|
||||
// if (it != m_canvases.end())
|
||||
// {
|
||||
// bool res = it->second->set_current(force);
|
||||
// if (res)
|
||||
// {
|
||||
// m_current = canvas;
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// m_current = nullptr;
|
||||
// return false;
|
||||
//}
|
||||
//#################################################################################################################
|
||||
|
||||
void GLCanvas3DManager::set_active(wxGLCanvas* canvas, bool active)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue