diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/opengl/qgl.cpp | 17 | ||||
-rw-r--r-- | src/opengl/qgl_p.h | 2 |
2 files changed, 15 insertions, 4 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 4eb7a194d9..1132411d42 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -4084,7 +4084,13 @@ bool QGLWidget::isSharing() const void QGLWidget::makeCurrent() { Q_D(QGLWidget); - d->glcx->makeCurrent(); + d->makeCurrent(); +} + +bool QGLWidgetPrivate::makeCurrent() +{ + glcx->makeCurrent(); + return QGLContext::currentContext() == glcx; } /*! @@ -4422,7 +4428,8 @@ void QGLWidget::resizeEvent(QResizeEvent *e) QWidget::resizeEvent(e); if (!isValid()) return; - makeCurrent(); + if (!d->makeCurrent()) + return; if (!d->glcx->initialized()) glInit(); const qreal scaleFactor = (window() && window()->windowHandle()) ? @@ -4537,7 +4544,8 @@ void QGLWidget::glInit() Q_D(QGLWidget); if (!isValid()) return; - makeCurrent(); + if (!d->makeCurrent()) + return; initializeGL(); d->glcx->setInitialized(true); } @@ -4555,7 +4563,8 @@ void QGLWidget::glDraw() Q_D(QGLWidget); if (!isValid()) return; - makeCurrent(); + if (!d->makeCurrent()) + return; #ifndef QT_OPENGL_ES if (d->glcx->deviceIsPixmap() && !d->glcx->contextHandle()->isOpenGLES()) qgl1_functions()->glDrawBuffer(GL_FRONT); diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 6b4d83888f..ed364283cc 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -145,6 +145,8 @@ public: glcx->reset(); } + bool makeCurrent(); + QGLContext *glcx; QGLWidgetGLPaintDevice glDevice; bool autoSwap; |