aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/coreapi/qsgdefaultrenderer.cpp
diff options
context:
space:
mode:
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>2012-04-11 17:39:46 +0200
committerQt by Nokia <qt-info@nokia.com>2012-05-25 10:01:11 +0200
commit70dee431e82aa4596aa993570120ab9afc7b608b (patch)
tree6349d66a034b33d3bb3b45d5c5d12a726beb7ce5 /src/quick/scenegraph/coreapi/qsgdefaultrenderer.cpp
parent8c68dcd2aa98f12d4e5c731dbc04a49c05917ed8 (diff)
Simplify the depth transformation in the scene graph.
Use default depth function GL_LESS and depth clear value 1, and set the near and far clipping planes to -1 and 1. This change will make the transformations a bit easier for people who implement custom 3D geometry since [-1, 1] is the typical z-range after a projection transformation. The change has no visual impact on 2D geometry. Change-Id: I75d4a8acc15131ffaa5d13a749e42dffbc1d09db Reviewed-by: Glenn Watson <glenn.watson@nokia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Diffstat (limited to 'src/quick/scenegraph/coreapi/qsgdefaultrenderer.cpp')
-rw-r--r--src/quick/scenegraph/coreapi/qsgdefaultrenderer.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgdefaultrenderer.cpp b/src/quick/scenegraph/coreapi/qsgdefaultrenderer.cpp
index 56d549e94f..c04afd7a32 100644
--- a/src/quick/scenegraph/coreapi/qsgdefaultrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgdefaultrenderer.cpp
@@ -231,11 +231,11 @@ void QSGDefaultRenderer::render()
glEnable(GL_DEPTH_TEST);
glDepthMask(true);
- glDepthFunc(GL_GREATER);
+ glDepthFunc(GL_LESS);
#if defined(QT_OPENGL_ES)
- glClearDepthf(0);
+ glClearDepthf(1);
#else
- glClearDepth(0);
+ glClearDepth(1);
#endif
glDisable(GL_SCISSOR_TEST);
@@ -298,9 +298,6 @@ void QSGDefaultRenderer::render()
int debugtimeSorting = debugTimer.elapsed();
#endif
- m_renderOrderMatrix.setToIdentity();
- m_renderOrderMatrix.scale(1, 1, qreal(1) / m_currentRenderOrder);
-
int opaqueStart = 0;
int transparentStart = 0;
for (int i = 0; i < m_renderGroups.size(); ++i) {
@@ -523,16 +520,16 @@ void QSGDefaultRenderer::renderNodes(QSGNode *const *nodes, int count)
}
if (changes & QSGRenderNode::DepthState) {
#if defined(QT_OPENGL_ES)
- glClearDepthf(0);
+ glClearDepthf(1);
#else
- glClearDepth(0);
+ glClearDepth(1);
#endif
if (m_clear_mode & QSGRenderer::ClearDepthBuffer) {
glDepthMask(true);
glClear(GL_DEPTH_BUFFER_BIT);
}
glDepthMask(false);
- glDepthFunc(GL_GREATER);
+ glDepthFunc(GL_LESS);
}
if (changes & QSGRenderNode::ColorState)
bindable()->reactivate();
@@ -617,7 +614,7 @@ void QSGDefaultRenderer::renderNodes(QSGNode *const *nodes, int count)
if (changeRenderOrder) {
currentRenderOrder = geomNode->renderOrder();
m_current_projection_matrix.setColumn(3, projection.column(3)
- + currentRenderOrder
+ + (m_currentRenderOrder - 1 - 2 * currentRenderOrder)
* m_current_projection_matrix.column(2));
updates |= QSGMaterialShader::RenderState::DirtyMatrix;
}