diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-05-25 12:56:27 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-05-27 10:43:11 (GMT) |
commit | 15c8f565973592c9929cdd6fc83d61641aa63afa (patch) | |
tree | b0a2e1754164b715572c6d088651d9d3859e26f7 /src/opengl/qglframebufferobject.cpp | |
parent | cfdfdf079c4a2095c588dd8af8403c74d2cfa37a (diff) | |
download | Qt-15c8f565973592c9929cdd6fc83d61641aa63afa.zip Qt-15c8f565973592c9929cdd6fc83d61641aa63afa.tar.gz Qt-15c8f565973592c9929cdd6fc83d61641aa63afa.tar.bz2 |
Fixed bugs in GL2 paint engine when several engines are active.
Make sure makeCurrent() on a window surface unbinds any active FBO, and
simplify ensureActive() code in GL2 paint engine a bit. We don't need
the last_engine pointer as ensureActive() will take care of ensuring the
correct engine is active anway.
Diffstat (limited to 'src/opengl/qglframebufferobject.cpp')
-rw-r--r-- | src/opengl/qglframebufferobject.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 338ce1f..3e7ca0a 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -804,8 +804,10 @@ bool QGLFramebufferObject::bind() const QGLContext *context = QGLContext::currentContext(); if (d->valid && context) { // Save the previous setting to automatically restore in release(). - d->previous_fbo = context->d_ptr->current_fbo; - context->d_ptr->current_fbo = d->fbo; + if (context->d_ptr->current_fbo != d->fbo) { + d->previous_fbo = context->d_ptr->current_fbo; + context->d_ptr->current_fbo = d->fbo; + } } return d->valid; } @@ -834,8 +836,10 @@ bool QGLFramebufferObject::release() const QGLContext *context = QGLContext::currentContext(); if (context) { // Restore the previous setting for stacked framebuffer objects. - context->d_ptr->current_fbo = d->previous_fbo; - glBindFramebuffer(GL_FRAMEBUFFER_EXT, d->previous_fbo); + if (d->previous_fbo != context->d_ptr->current_fbo) { + context->d_ptr->current_fbo = d->previous_fbo; + glBindFramebuffer(GL_FRAMEBUFFER_EXT, d->previous_fbo); + } d->previous_fbo = 0; } |