summaryrefslogtreecommitdiffstats
path: root/src/opengl/qgl.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-05-25 12:56:27 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-05-27 10:43:11 (GMT)
commit15c8f565973592c9929cdd6fc83d61641aa63afa (patch)
treeb0a2e1754164b715572c6d088651d9d3859e26f7 /src/opengl/qgl.cpp
parentcfdfdf079c4a2095c588dd8af8403c74d2cfa37a (diff)
downloadQt-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/qgl.cpp')
-rw-r--r--src/opengl/qgl.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 0a2a196..62a592a 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -4391,6 +4391,15 @@ void QGLDrawable::swapBuffers()
void QGLDrawable::makeCurrent()
{
+ previous_fbo = 0;
+ if (!pixmapData && !fbo) {
+ QGLContext *ctx = context();
+ previous_fbo = ctx->d_ptr->current_fbo;
+ ctx->d_ptr->current_fbo = 0;
+ if (previous_fbo)
+ glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0);
+ }
+
if (widget)
widget->makeCurrent();
#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL)
@@ -4428,6 +4437,12 @@ void QGLDrawable::doneCurrent()
}
#endif
+ if (previous_fbo) {
+ QGLContext *ctx = context();
+ ctx->d_ptr->current_fbo = previous_fbo;
+ glBindFramebuffer(GL_FRAMEBUFFER_EXT, previous_fbo);
+ }
+
if (fbo && !wasBound)
fbo->release();
}