diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-06-25 12:42:09 +0200 |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-06-25 13:19:40 +0200 |
commit | 9c4d6ec25ff1984b1e56363f3b8728ad7f256876 (patch) | |
tree | e8dcebd78cd46d345a0fedad3566234c79081338 /src/opengl/gl2paintengineex | |
parent | e3886938f27da1ed460de83235d9fd3d5abd4713 (diff) | |
download | qt4-tools-9c4d6ec25ff1984b1e56363f3b8728ad7f256876.tar.gz |
Fixed missing restoration of state after a sync in the GL 2 engine.
The sync() function properly sets up the state to allow using raw
OpenGL commands with an active QPainter, but we also need to properly
restore the state after sync() has been called and some other painting
operation is done.
Reviewed-by: Trond
Diffstat (limited to 'src/opengl/gl2paintengineex')
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 12 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h | 2 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 91df197c1b..e24742f876 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -654,6 +654,9 @@ void QGL2PaintEngineEx::sync() glDisable(GL_BLEND); glActiveTexture(GL_TEXTURE0); + + d->needsSync = true; + d->shaderManager->setDirty(); } void QGL2PaintEngineExPrivate::transferMode(EngineMode newMode) @@ -1216,6 +1219,7 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) d->simpleShaderDepthUniformDirty = true; d->depthUniformDirty = true; d->opacityUniformDirty = true; + d->needsSync = false; d->use_system_clip = !systemClip().isEmpty(); @@ -1294,11 +1298,15 @@ void QGL2PaintEngineEx::ensureActive() ctx->d_ptr->active_engine = this; - glDisable(GL_DEPTH_TEST); + d->needsSync = true; + } + if (d->needsSync) { glViewport(0, 0, d->width, d->height); - + glDepthMask(false); + glDepthFunc(GL_LEQUAL); setState(state()); + d->needsSync = false; } } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 448964b787..0d28a49890 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -248,6 +248,8 @@ public: uint uniformIdentifiers[NumUniforms]; GLuint lastTexture; + + bool needsSync; }; QT_END_NAMESPACE |