From c81632df3e9d52011487cfe0bd2e40ba5c5f2d54 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Mon, 25 Nov 2013 10:06:36 +0100 Subject: Fix rendering of Flipable content. When a batch is merged in the renderer, we use the z component to stack the item front to back. This works because each item is guaranteed to have a z-range of 0->1. However, when a projective matrix is used, we need to compensate for the implicit [x,y,z]/w, which GL applies to gl_Position after the vertex stage completes, so that this guarantee still holds. Task-number: QTBUG-35020 Change-Id: I254a3d4dc9ad22f53717160ec6ad8f3a27b43d1c Reviewed-by: Laszlo Agocs --- src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp b/src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp index 909def2c19..2849eff304 100644 --- a/src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp +++ b/src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp @@ -222,7 +222,7 @@ QByteArray qsgShaderRewriter_insertZAttributes(const char *input, QSurfaceFormat braceDepth--; if (braceDepth == 0) { result += QByteArray::fromRawData(voidPos, tok.pos - 1 - voidPos); - result += QByteArrayLiteral(" gl_Position.z = gl_Position.z * _qt_zRange + _qt_order;\n"); + result += QByteArrayLiteral(" gl_Position.z = (gl_Position.z * _qt_zRange + _qt_order) * gl_Position.w;\n"); result += QByteArray(tok.pos - 1); return result; } -- cgit v1.2.3