I have recently gone through all the tutorials at http://www.rastertek.com/tutdx11s2.html to learn DirectX11 pipeline. I have gotten a pretty good grasp of how the pipeline works and what the code is doing. (though I know very little about all the various options chosen in the initialization process, or what possible changes could be made yet). The code is quite long but it basically sets everything up to draw a single textured triangle. I'm having trouble getting this code to draw a 2nd triangle.
I've searched the forums for help but mostly came up with D3D9 code example which using a different function to draw the primitives.
Here is the relevent code:
// Set the number of vertices in the vertex array.
m_vertexCount = 3;
// Set the number of indices in the index array.
m_indexCount = 3;
// Load the vertex array with data.
vertices[0].position = XMFLOAT3(-1.0f, 1.0f, 0.0f); // Bottom left.
vertices[0].texture = XMFLOAT2(0.0f, 0.0f);
vertices[1].position = XMFLOAT3(1.0f, 1.0f, 0.0f); // Top middle.
vertices[1].texture = XMFLOAT2(1.0f, 0.0f);
vertices[2].position = XMFLOAT3(-1.0f, -1.0f, 0.0f); // Bottom right.
vertices[2].texture = XMFLOAT2(0.0f, 1.0f);
// Load the index array with data.
indices[0] = 0; // Bottom left.
indices[1] = 1; // Top middle.
indices[2] = 2; // Bottom right.
// Along with hundres of lines of initialization and run-time code not shown
// This line draws the triangle correctly.
deviceContext->DrawIndexed(indexCount, 0, 0);
Now if I change it to this:
It still only draws the first traingle, and never draws. the 2nd. I know IndexCount is being set to 6. I also know the index buffer is working correctly with the vertex buffer because I can change: indices[2]=2 to indices[2]=3 and a different triangle gets drawn. I'm curious if anyone familiar with this tutorial series, or just D3DX11 in general might clue me in on how DrawIndexed works, or if there is some obvious setting somehwere to let it know it needs to draw more than 1 triangle?