Original Post
Hi
I''ve been working with the DX 9 tutorials.
They are not very good at explaing everything and after searching and a lot of reading I finally figured out what vertices and matrices are.
Anyway, through my reading, I stumbled upon D3DPT_TRIANGLESTRIP. According to the tutorial, I can add only one extra vertice to create 2 triangles. I tried modifying the following to get the desired effect:
CUSTOMVERTEX vertices[] =
{
{ 150.0f, 50.0f, 0.5f, 1.0f, 0xffff0000, },
{ 250.0f, 250.0f, 0.5f, 1.0f, 0xff00ff00, },
{ 50.0f, 250.0f, 0.5f, 1.0f, 0xff0000ff, },
};
to:
CUSTOMVERTEX vertices[] =
{
{ 150.0f, 50.0f, 0.5f, 1.0f, 0xffff0000, },
{ 250.0f, 250.0f, 0.5f, 1.0f, 0xff00ff00, },
{ 50.0f, 250.0f, 0.5f, 1.0f, 0xff0000ff, },
{ 0.0f, 50.0f, 0.5f, 1.0f, 0xffff00ff, },
};
...
if( FAILED( g_pD3DDevice->CreateVertexBuffer( 3*sizeof(CUSTOMVERTEX), 0, D3DFVF_CUSTOMVERTEX, D3DPOOL_DEFAULT, &g_pD3DVertexBuffer, NULL ) ) )
to:
if( FAILED( g_pD3DDevice->CreateVertexBuffer( 4*sizeof(CUSTOMVERTEX), 0, D3DFVF_CUSTOMVERTEX, D3DPOOL_DEFAULT, &g_pD3DVertexBuffer, NULL ) ) )
...
g_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 1);
to:
g_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
This however does not seem to work.
Any help would be appreciated
Talib