forked from Mirrors/openclonk
Move all viewport drawing to QOpenGLWidget::paintGL
Unfortunately, this still doesn't fix rendering. Note that the paintGL() isn't called periodically yet, only when resizing the window.qteditor
parent
eefa8749a8
commit
4290038909
|
@ -307,7 +307,17 @@ void C4ConsoleQtViewportView::leaveEvent(QEvent *)
|
|||
::Console.EditCursor.SetMouseHover(false);
|
||||
}
|
||||
|
||||
void C4ConsoleQtViewportView::initializeGL() { }
|
||||
void C4ConsoleQtViewportView::initializeGL()
|
||||
{
|
||||
// init extensions
|
||||
glewExperimental = GL_TRUE;
|
||||
GLenum err = glewInit();
|
||||
if (GLEW_OK != err)
|
||||
{
|
||||
// Problem: glewInit failed, something is seriously wrong.
|
||||
LogF("glewInit: %s", reinterpret_cast<const char*>(glewGetErrorString(err)));
|
||||
}
|
||||
}
|
||||
|
||||
void C4ConsoleQtViewportView::resizeGL(int w, int h)
|
||||
{
|
||||
|
@ -316,8 +326,7 @@ void C4ConsoleQtViewportView::resizeGL(int w, int h)
|
|||
|
||||
void C4ConsoleQtViewportView::paintGL()
|
||||
{
|
||||
// Painting is done regularily elsewhere anyways.
|
||||
/* cvp->Execute(); */
|
||||
cvp->Execute();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -170,13 +170,13 @@ bool C4Viewport::TogglePlayerLock() {return 0;}
|
|||
|
||||
void C4ViewportWindow::PerformUpdate()
|
||||
{
|
||||
#ifndef WITH_QT_EDITOR // done by callback
|
||||
if (cvp)
|
||||
{
|
||||
#ifndef WITH_QT_EDITOR // done by callback
|
||||
cvp->UpdateOutputSize();
|
||||
#endif
|
||||
cvp->Execute();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
C4Window * C4ViewportWindow::Init(int32_t Player)
|
||||
|
|
|
@ -683,17 +683,17 @@ bool CStdGLCtxQt::Init(C4Window *window, C4AbstractApp *app)
|
|||
context = new QOpenGLContext();
|
||||
if (!context->create())
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Select(true)) return false;
|
||||
if (!Select(true)) return false;
|
||||
|
||||
// init extensions
|
||||
glewExperimental = GL_TRUE;
|
||||
GLenum err = glewInit();
|
||||
if (GLEW_OK != err)
|
||||
{
|
||||
// Problem: glewInit failed, something is seriously wrong.
|
||||
return pGL->Error(reinterpret_cast<const char*>(glewGetErrorString(err)));
|
||||
// init extensions
|
||||
glewExperimental = GL_TRUE;
|
||||
GLenum err = glewInit();
|
||||
if (GLEW_OK != err)
|
||||
{
|
||||
// Problem: glewInit failed, something is seriously wrong.
|
||||
return pGL->Error(reinterpret_cast<const char*>(glewGetErrorString(err)));
|
||||
}
|
||||
}
|
||||
|
||||
this_context = contexts.insert(contexts.end(), this);
|
||||
|
@ -708,7 +708,10 @@ bool CStdGLCtxQt::Select(bool verbose)
|
|||
return false;
|
||||
}
|
||||
else
|
||||
pWindow->glwidget->makeCurrent();
|
||||
{
|
||||
// done automatically
|
||||
/* pWindow->glwidget->makeCurrent(); */
|
||||
}
|
||||
SelectCommon();
|
||||
// update clipper - might have been done by UpdateSize
|
||||
// however, the wrong size might have been assumed
|
||||
|
@ -726,7 +729,10 @@ void CStdGLCtxQt::Deselect()
|
|||
if (context)
|
||||
context->doneCurrent();
|
||||
else
|
||||
pWindow->glwidget->doneCurrent();
|
||||
{
|
||||
// done automatically
|
||||
/* pWindow->glwidget->doneCurrent(); */
|
||||
}
|
||||
if (pGL && pGL->pCurrCtx == this)
|
||||
{
|
||||
pGL->pCurrCtx = 0;
|
||||
|
@ -741,7 +747,6 @@ bool CStdGLCtxQt::PageFlip()
|
|||
if (!pWindow) return false;
|
||||
if (context)
|
||||
return false;
|
||||
pWindow->glwidget->update();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue