diff options
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 3 | ||||
-rw-r--r-- | src/opengl/qgl.cpp | 32 | ||||
-rw-r--r-- | src/opengl/qgl_p.h | 2 | ||||
-rw-r--r-- | src/opengl/qglpaintdevice.cpp | 1 |
4 files changed, 25 insertions, 13 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 6365a7421b..cc97bed3f7 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -2099,9 +2099,8 @@ bool QGL2PaintEngineEx::end() d->device->endPaint(); ctx->d_ptr->active_engine = 0; - + ctx->makeCurrent(); d->resetOpenGLContextActiveEngine(); - d->resetGLState(); delete d->shaderManager; diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index d9f2113c14..e136ddcff2 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2104,17 +2104,17 @@ struct DDSFormat { would mirror the image and automatically generate mipmaps. This option helps preserve this default behavior. - \omitvalue CanFlipNativePixmapBindOption Used by x11 from pixmap to choose - whether or not it can bind the pixmap upside down or not. + \omitvalue CanFlipNativePixmapBindOption \omit Used by x11 from pixmap to choose + whether or not it can bind the pixmap upside down or not. \endomit - \omitvalue MemoryManagedBindOption Used by paint engines to + \omitvalue MemoryManagedBindOption \omit Used by paint engines to indicate that the pixmap should be memory managed along side with the pixmap/image that it stems from, e.g. installing destruction - hooks in them. + hooks in them. \endomit - \omitvalue TemporarilyCachedBindOption Used by paint engines on some + \omitvalue TemporarilyCachedBindOption \omit Used by paint engines on some platforms to indicate that the pixmap or image texture is possibly - cached only temporarily and must be destroyed immediately after the use. + cached only temporarily and must be destroyed immediately after the use. \endomit \omitvalue InternalBindOption */ @@ -3603,7 +3603,8 @@ void QGLContext::makeCurrent() \fn void QGLContext::swapBuffers() const Call this to finish a frame of OpenGL rendering, and make sure to - call makeCurrent() again before you begin a new frame. + call makeCurrent() again before issuing any further OpenGL commands, + for example as part of a new frame. */ void QGLContext::swapBuffers() const { @@ -4084,7 +4085,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 +4429,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 +4545,8 @@ void QGLWidget::glInit() Q_D(QGLWidget); if (!isValid()) return; - makeCurrent(); + if (!d->makeCurrent()) + return; initializeGL(); d->glcx->setInitialized(true); } @@ -4555,7 +4564,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; diff --git a/src/opengl/qglpaintdevice.cpp b/src/opengl/qglpaintdevice.cpp index b29f71ad2e..c5151f66bb 100644 --- a/src/opengl/qglpaintdevice.cpp +++ b/src/opengl/qglpaintdevice.cpp @@ -126,6 +126,7 @@ void QGLPaintDevice::endPaint() { // Make sure the FBO bound at beginPaint is re-bound again here: QGLContext *ctx = context(); + ctx->makeCurrent(); ctx->d_func()->refreshCurrentFbo(); |