diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2009-08-26 15:29:28 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2009-08-26 15:33:02 (GMT) |
commit | a6f19188282b427272f075063a306c7ef98e8a95 (patch) | |
tree | f129f427fc7c2926880652c9800121b61bc8914b /src/opengl | |
parent | 4337df117dfa429776f2236141b570c4957e4a2a (diff) | |
download | Qt-a6f19188282b427272f075063a306c7ef98e8a95.zip Qt-a6f19188282b427272f075063a306c7ef98e8a95.tar.gz Qt-a6f19188282b427272f075063a306c7ef98e8a95.tar.bz2 |
Made GL 2 engine reset various GL state to their defaults in end().
This makes mixing GL and QPainter code safer. We need to be able to
assume default GL state in begin(), and set back whatever we change to
the default state in end() in the GL 2 paint engine.
Reviewed-by: Trond
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 12 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h | 1 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 95199fa..2f565cf 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -710,16 +710,20 @@ void QGL2PaintEngineEx::beginNativePainting() #endif d->lastTexture = GLuint(-1); + d->resetGLState(); + d->needsSync = true; +} + +void QGL2PaintEngineExPrivate::resetGLState() +{ glDisable(GL_BLEND); glActiveTexture(GL_TEXTURE0); - glDisable(GL_DEPTH_TEST); + glDisable(GL_SCISSOR_TEST); glDepthFunc(GL_LESS); glDepthMask(true); glClearDepth(1); - - d->needsSync = true; } void QGL2PaintEngineEx::endNativePainting() @@ -1364,6 +1368,8 @@ bool QGL2PaintEngineEx::end() d->drawable.doneCurrent(); d->ctx->d_ptr->active_engine = 0; + d->resetGLState(); + return false; } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 2eec4d5..66e7a51 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -170,6 +170,7 @@ public: void setBrush(const QBrush* brush); void transferMode(EngineMode newMode); + void resetGLState(); // fill, drawOutline, drawTexture & drawCachedGlyphs are the rendering entry points: void fill(const QVectorPath &path); |