forked from Mirrors/openclonk
Some cleanup in CStdGLCtxQt
parent
2a2fc68e3f
commit
cf708a7cb1
|
@ -655,16 +655,16 @@ bool CStdGLCtx::PageFlip()
|
||||||
#include <QOpenGLContext>
|
#include <QOpenGLContext>
|
||||||
#include <QOffscreenSurface>
|
#include <QOffscreenSurface>
|
||||||
|
|
||||||
CStdGLCtxQt::CStdGLCtxQt() { }
|
CStdGLCtxQt::CStdGLCtxQt() { context = NULL; surface = NULL; }
|
||||||
|
|
||||||
void CStdGLCtxQt::Clear(bool multisample_change)
|
void CStdGLCtxQt::Clear(bool multisample_change)
|
||||||
{
|
{
|
||||||
pWindow = nullptr;
|
|
||||||
if (context)
|
if (context)
|
||||||
{
|
{
|
||||||
delete context;
|
if (!pWindow->glwidget) delete context;
|
||||||
delete surface;
|
delete surface;
|
||||||
}
|
}
|
||||||
|
pWindow = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CStdGLCtxQt::Init(C4Window *window, C4AbstractApp *app)
|
bool CStdGLCtxQt::Init(C4Window *window, C4AbstractApp *app)
|
||||||
|
@ -693,6 +693,11 @@ bool CStdGLCtxQt::Init(C4Window *window, C4AbstractApp *app)
|
||||||
return pGL->Error(reinterpret_cast<const char*>(glewGetErrorString(err)));
|
return pGL->Error(reinterpret_cast<const char*>(glewGetErrorString(err)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// The Qt GL widget has its own context
|
||||||
|
context = pWindow->glwidget->context();
|
||||||
|
}
|
||||||
|
|
||||||
this_context = contexts.insert(contexts.end(), this);
|
this_context = contexts.insert(contexts.end(), this);
|
||||||
return true;
|
return true;
|
||||||
|
@ -700,7 +705,7 @@ bool CStdGLCtxQt::Init(C4Window *window, C4AbstractApp *app)
|
||||||
|
|
||||||
bool CStdGLCtxQt::Select(bool verbose)
|
bool CStdGLCtxQt::Select(bool verbose)
|
||||||
{
|
{
|
||||||
if (context)
|
if (!pWindow->glwidget)
|
||||||
{
|
{
|
||||||
if (!context->makeCurrent(surface))
|
if (!context->makeCurrent(surface))
|
||||||
return false;
|
return false;
|
||||||
|
@ -724,7 +729,7 @@ bool CStdGLCtxQt::Select(bool verbose)
|
||||||
|
|
||||||
void CStdGLCtxQt::Deselect()
|
void CStdGLCtxQt::Deselect()
|
||||||
{
|
{
|
||||||
if (context)
|
if (!pWindow->glwidget)
|
||||||
context->doneCurrent();
|
context->doneCurrent();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -743,7 +748,7 @@ bool CStdGLCtxQt::PageFlip()
|
||||||
// flush GL buffer
|
// flush GL buffer
|
||||||
glFlush();
|
glFlush();
|
||||||
if (!pWindow) return false;
|
if (!pWindow) return false;
|
||||||
if (context)
|
if (!pWindow->glwidget)
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue