diff options
author | Tom Cooksey <thomas.cooksey@nokia.com> | 2009-09-03 14:24:17 (GMT) |
---|---|---|
committer | Tom Cooksey <thomas.cooksey@nokia.com> | 2009-09-04 12:42:52 (GMT) |
commit | b3b9813f1083fc556aea1f952329551da97aee90 (patch) | |
tree | c6f6f680c70bd5c795bf6e17eeb90820c0a16ad2 /src | |
parent | dfa5a8acc44d2acda4d32ee79f2556fb030c3ab1 (diff) | |
download | Qt-b3b9813f1083fc556aea1f952329551da97aee90.zip Qt-b3b9813f1083fc556aea1f952329551da97aee90.tar.gz Qt-b3b9813f1083fc556aea1f952329551da97aee90.tar.bz2 |
Make QGLFramebufferObject::isBound() check it is the bound fbo
Previously, it was possible that painting using QPainter to a different
GL target (E.g. QGLWidget) would unbind the FBO. In such cases, isBound
returned true, even though the FBO wasn't bound to any context.
Reviewed-by: Samuel
Diffstat (limited to 'src')
-rw-r--r-- | src/opengl/qglframebufferobject.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 8e97edf..94e3930 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -273,7 +273,7 @@ void QGLFramebufferObjectFormat::setInternalTextureFormat(QMacCompatGLenum inter class QGLFramebufferObjectPrivate { public: - QGLFramebufferObjectPrivate() : depth_stencil_buffer(0), valid(false), bound(false), ctx(0), previous_fbo(0), engine(0) {} + QGLFramebufferObjectPrivate() : depth_stencil_buffer(0), valid(false), ctx(0), previous_fbo(0), engine(0) {} ~QGLFramebufferObjectPrivate() {} void init(const QSize& sz, QGLFramebufferObject::Attachment attachment, @@ -287,7 +287,6 @@ public: QSize size; QGLFramebufferObjectFormat format; uint valid : 1; - uint bound : 1; QGLFramebufferObject::Attachment fbo_attachment; QGLContext *ctx; // for Windows extension ptrs GLuint previous_fbo; @@ -792,7 +791,7 @@ bool QGLFramebufferObject::bind() Q_D(QGLFramebufferObject); QGL_FUNC_CONTEXT; glBindFramebuffer(GL_FRAMEBUFFER_EXT, d->fbo); - d->bound = d->valid = d->checkFramebufferStatus(); + d->valid = d->checkFramebufferStatus(); const QGLContext *context = QGLContext::currentContext(); if (d->valid && context) { // Save the previous setting to automatically restore in release(). @@ -823,7 +822,6 @@ bool QGLFramebufferObject::release() return false; Q_D(QGLFramebufferObject); QGL_FUNC_CONTEXT; - d->bound = false; const QGLContext *context = QGLContext::currentContext(); if (context) { @@ -1102,7 +1100,7 @@ QGLFramebufferObject::Attachment QGLFramebufferObject::attachment() const bool QGLFramebufferObject::isBound() const { Q_D(const QGLFramebufferObject); - return d->bound; + return d->ctx->d_ptr->current_fbo == d->fbo; } /*! |