Clarify the front face winding order in the Vulkan examples

After applying the correction matrix the front face is CW, not CCW.

The examples work either way but fix them up to avoid reader confusion.

Change-Id: I491e6dc17c21897a59f36d32061e937f2b6c4c9d
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This commit is contained in:
Laszlo Agocs 2017-03-24 14:16:32 +01:00
parent 92dce210a2
commit dfef2e3f3e
3 changed files with 7 additions and 3 deletions

View File

@ -612,8 +612,8 @@ void VulkanRenderer::initResources()
memset(&rs, 0, sizeof(rs));
rs.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
rs.polygonMode = VK_POLYGON_MODE_FILL;
rs.cullMode = VK_CULL_MODE_NONE; // we want the back face as well
rs.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE;
rs.cullMode = VK_CULL_MODE_BACK_BIT;
rs.frontFace = VK_FRONT_FACE_CLOCKWISE;
rs.lineWidth = 1.0f;
pipelineInfo.pRasterizationState = &rs;

View File

@ -337,7 +337,7 @@ void TriangleRenderer::initResources()
rs.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
rs.polygonMode = VK_POLYGON_MODE_FILL;
rs.cullMode = VK_CULL_MODE_NONE; // we want the back face as well
rs.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE;
rs.frontFace = VK_FRONT_FACE_CLOCKWISE;
rs.lineWidth = 1.0f;
pipelineInfo.pRasterizationState = &rs;

View File

@ -2692,6 +2692,10 @@ QImage QVulkanWindow::grab()
without any further corrections to the vertex Z positions, while using the
projection matrices retrieved from the QMatrix4x4 functions, such as
QMatrix4x4::perspective(), as-is.
\note With vertex data following the default OpenGL rules (that is, the
front face being CCW), the correct winding order in the rasterization state
after applying this matrix is clockwise (\c{VK_FRONT_FACE_CLOCKWISE}).
*/
const QMatrix4x4 *QVulkanWindow::clipCorrectionMatrix()
{