Thank you, I will have to look into these things, as I have just started using DirectX tonight.
Thanks Again
[edit]
Trying to use trianglestrips.. but running into some problems.
Here is the coordinates for the strip.
Code:
DxVertex trianglestrip[] = {
{ 160.0f, 100.0f, 1.0f, 1.0f, 0xFFFFFFFF },
{ 480.0f, 100.0f, 1.0f, 1.0f, 0xFFFFFFFF },
{ 160.0f, 360.0f, 1.0f, 1.0f, 0xFFFFFFFF },
{ 480.0f, 360.0f, 1.0f, 1.0f, 0xFFFFFFFF },
};
its { x, y, z, w, color }
And what I get is only the first three vertecies show up. Shouldnt the last vertex create a "square"?
I pass it like this
Code:
gD3D->Render ( trianglestrip, 4 );
Here is the Render definition
Code:
bool D3Dclass::Render ( DxVertex *VertList, int num_verts )
{
int vert_list_size = sizeof ( DxVertex ) * num_verts;
assert ( vert_list_size > 0 );
IDirect3DVertexBuffer9 *VertexBuffer;
HRESULT result = D3DDevice->CreateVertexBuffer ( vert_list_size, 0, DxVertexType, D3DPOOL_DEFAULT, &VertexBuffer, NULL );
if ( result != D3D_OK ) return false;
void *verts = NULL;
result = VertexBuffer->Lock ( 0, 0, ( void** ) &verts, D3DLOCK_DISCARD );
if ( result != D3D_OK ) {
VertexBuffer->Release ();
return false;
}
memcpy ( verts, VertList, vert_list_size );
VertexBuffer->Unlock ();
D3DDevice->SetStreamSource ( 0, VertexBuffer, 0, sizeof ( DxVertex ) );
D3DDevice->SetFVF ( DxVertexType );
D3DDevice->DrawPrimitive ( D3DPT_TRIANGLESTRIP, 0, 1 );
VertexBuffer->Release ();
return true;
}