diff options
author | Gunnar Sletta <gunnar.sletta@nokia.com> | 2010-12-22 14:38:28 +0100 |
---|---|---|
committer | Gunnar Sletta <gunnar.sletta@nokia.com> | 2010-12-22 14:38:28 +0100 |
commit | 535a1209735a035eb8454fba784e887ba59eaa6b (patch) | |
tree | a65d8925933580ada657e1efaf124052924143cf | |
parent | 413c289bfb82cb2186de9ab1a0a9b7fc537c310d (diff) |
Fix clipping Flipable
The problem is that if we go from scissor clip to
stencil clip, we don't unset the scissor until after
we have completed the stencil drawing. The result is
that the stencil drawing is clipped away by the scissor.
Problem is solved by disabling scissor before applying
the clip stack.
-rw-r--r-- | src/scenegraph/coreapi/renderer.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/scenegraph/coreapi/renderer.cpp b/src/scenegraph/coreapi/renderer.cpp index 3b8bfa6..aaa4ffa 100644 --- a/src/scenegraph/coreapi/renderer.cpp +++ b/src/scenegraph/coreapi/renderer.cpp @@ -248,16 +248,14 @@ Renderer::ClipType Renderer::updateStencilClip(const ClipNode *clip) { if (!clip) { glDisable(GL_STENCIL_TEST); -#ifndef QT_GL_NO_SCISSOR_TEST glDisable(GL_SCISSOR_TEST); -#endif return NoClip; } bool stencilEnabled = false; -#ifndef QT_GL_NO_SCISSOR_TEST bool scissorEnabled = false; -#endif + + glDisable(GL_SCISSOR_TEST); int clipDepth = 0; QRect clipRect; @@ -268,7 +266,6 @@ Renderer::ClipType Renderer::updateStencilClip(const ClipNode *clip) const QMatrix4x4 &m = matrix; -#ifndef QT_GL_NO_SCISSOR_TEST // TODO: Check for multisampling and pixel grid alignment. bool canUseScissor = (clip->flags() & Node::ClipIsRectangular) && qFuzzyIsNull(m(0, 1)) && qFuzzyIsNull(m(0, 2)) @@ -299,9 +296,7 @@ Renderer::ClipType Renderer::updateStencilClip(const ClipNode *clip) glScissor(clipRect.x(), clipRect.y(), clipRect.width(), clipRect.height()); else glScissor(0, 0, 0, 0); - } else -#endif - { + } else { if (!stencilEnabled) { if (!m_clip_program.isLinked()) { m_clip_program.addShaderFromSourceCode(QGLShader::Vertex, @@ -370,10 +365,8 @@ Renderer::ClipType Renderer::updateStencilClip(const ClipNode *clip) glDisable(GL_STENCIL_TEST); } -#ifndef QT_GL_NO_SCISSOR_TEST if (!scissorEnabled) glDisable(GL_SCISSOR_TEST); -#endif return stencilEnabled ? StencilClip : ScissorClip; } |