diff options
Diffstat (limited to 'src/opengl/qgl.cpp')
-rw-r--r-- | src/opengl/qgl.cpp | 32 |
1 files changed, 21 insertions, 11 deletions
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); |