A noob question about programming with DirectX

NuclearNed

Raconteur
May 18, 2001
7,881
378
126
I'm beginning to tinker around with DirectX a little, and I'm looking at the "vertices" example in the SDK.

I'm trying to draw two triangle primitives in a window. The vertex list is this:

CUSTOMVERTEX vertices[] =
{
{ 100.0f, 0.0f, 0.5f, 10.0f, 0xffff0000 }, // x, y, z, rhw, color
{ 100.0f, 100.0f, 0.5f, 10.0f, 0x0000ffff },
{ 0.0f, 100.0f, 0.5f, 10.0f, 0x00ffff00 },
{ 210.0f, 210.0f, 0.5f, 10.0f, 0xffff0000 },
{ 320.0f, 210.0f, 0.5f, 10.0f, 0x0000ffff },
{ 210.0f, 320.0f, 0.5f, 10.0f, 0x00ffff00 }
};

And the call to draw the primitives is this:

g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, 1 );

This successfully draws the first triangle. However, if I change the 3rd parameter in DrawPrimitive() to a 2 to draw both triangles in the same frame, neither triangle gets drawn. Or if I want to draw just the 2nd triangle, neither gets drawn (see line of code below).

g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 3, 1 );

What is going on with this code?
 

NuclearNed

Raconteur
May 18, 2001
7,881
378
126
Nevermind - I just figured out my problem.

However, a :beer: for LordPhoenix just for replying. Who says I'm not gracious???