diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-06-25 10:42:09 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-06-25 11:19:40 (GMT) |
commit | 9c4d6ec25ff1984b1e56363f3b8728ad7f256876 (patch) | |
tree | e8dcebd78cd46d345a0fedad3566234c79081338 /src/opengl/gl2paintengineex | |
parent | e3886938f27da1ed460de83235d9fd3d5abd4713 (diff) | |
download | Qt-9c4d6ec25ff1984b1e56363f3b8728ad7f256876.zip Qt-9c4d6ec25ff1984b1e56363f3b8728ad7f256876.tar.gz Qt-9c4d6ec25ff1984b1e56363f3b8728ad7f256876.tar.bz2 |
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 91df197..e24742f 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 448964b..0d28a49 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 |