#define CUSTOMFVF (D3DFVF_XYZRHW | D3DFVF_DIFFUSE )
I an trying to render a rectangle like this, it renders in linelist mode so i can see if the cordinates are correct, so what i want todo now is change it to 2 tranges to make a solid rectangle, but i can only seem to make 1 trangle render , not sure why?
CUSTOMVERTEX vertices[] =
{
//x //y
/*450 */{ 150.0f, 62.5f, 0.5f, 1.0f, D3DCOLOR_XRGB(0, 0, 255), }, //top left
{ 325.0f, 500.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(0, 255, 0), }, //bottom right
{ 150.0f, 500.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(255, 0, 0), }, //bottom left
{150.0f, 62.5f, 0.5f, 1.0f, D3DCOLOR_XRGB(0, 0, 255), }, //top left
{ 325.0f, 62.5f, 0.5f, 1.0f, D3DCOLOR_XRGB(0, 0, 255), }, //top right
{ 325.0f, 500.0f, 0.5f, 1.0f, D3DCOLOR_XRGB(0, 0, 255), }, //bottom right
};
// create a vertex buffer interface called v_buffer
d3ddev->CreateVertexBuffer(6*sizeof(CUSTOMVERTEX),
0,
CUSTOMFVF,
D3DPOOL_MANAGED,
&v_buffer,
NULL);
VOID* pVoid; // a void pointer
// lock v_buffer and load the vertices into it
v_buffer->Lock(0, 0, (void**)&pVoid, 0);
memcpy(pVoid, vertices, sizeof(vertices));
v_buffer->Unlock();
in the rendering function
// select which vertex format we are using
d3ddev->SetFVF(CUSTOMFVF);
// select the vertex buffer to display
d3ddev->SetStreamSource(0, v_buffer, 0, sizeof(CUSTOMVERTEX));
// copy the vertex buffer to the back buffer
// d3ddev->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0,2);
d3ddev->DrawPrimitive(D3DPT_LINESTRIP, 0,5);