27060

# Vertex Winding Order in DX11

I'm trying to draw a simple square with dx11, but the order of the indices of each triangle determines whether or not it shows up. I set the cull mode to none in the rasterizer state, but it doesn't seem to change anything.

If I specify the vertices of the first triangle to be 0, 1, 2 instead of 2, 1, 0 then the triangle doesn't show up. So my question is, do I need to order the vertices of a triangle in a specific way regardless of the cull mode?

P.S. I'm drawing a triangle list and not a strip.

```UINT indices[] = {2, 1, 0, 1, 3, 0}; MeshVertex vertices[] = { { Vector3(1.0f, 1.0f, 0.0f)}, //Top Right { Vector3(-1.0f, -1.0f, 0.0f)}, //Bottom Left { Vector3(1.0f, -1.0f, 0.0f)}, //Bottom Right { Vector3(-1.0f, 1.0f, 0.0f)} //Top Left }; mesh = new Mesh(vertices, indices, 4, 6, shader); ```

So my question is, do I need to order the vertices of a triangle in a specific way regardless of the cull mode?

** Define/Draw your vertices in clockwise order, and don't change the default the cull mode.**

To determine whether a triangle can be displayed, you have to considering 2 factors

<ol> <li>The front face, or you call it winding order, by default Direct3D treat a vertices defined in clockwise order as a front face, and all faces other than front faces are back faces.</li> <li>The culling mode, by default, Direct3D will cull the back faces(the faces which vertices defined in counter-clockwise order).</li> </ol>

You can set the front face and culling mode in D3D11_RASTERIZER_DESC structure

The reason why you didn't see difference when you change the culling mode to NONE is because both triangle were in the same order and D3D11_CULL_NONE means didn't cull any faces.

If triangle 1 is in clockwise order and triangle 2 is in counter clockwise order, you will only see one triangle when you set the cull mode to D3D11_CULL_FRONT or D3D11_CULL_BACK, and see both when you set it to D3D11_CULL_NONE.