thanks for the help MrWizard
im trying to draw half a 3D pyramid but it only draws one of the triangles what am i doing wrong?
Code:
tVertex vertexarray[6] ={
{1.0f,0.0f,0.0f, D3DCOLOR_RGBA(200,0,0,0)},
{-1.0f,0.0f,0.0f,D3DCOLOR_RGBA(200,0,0,0)},
{0.0f,1.0f,0.0f, D3DCOLOR_RGBA(200,0,0,0)},
{1.0f,0.0f,0.0f, D3DCOLOR_RGBA(0,200,0,0)},
{1.0f,0.0f,0.0f, D3DCOLOR_RGBA(0,200,0,0)},
{0.0f,1.0f,0.0f, D3DCOLOR_RGBA(0,200,0,0)}
};
Code:
D3DXMATRIXA16 matWorld;
D3DXMATRIXA16 matRotate;
D3DXMATRIXA16 matTranslation;
sDevice->BeginScene();
sDevice->SetFVF(D3DFVF_XYZ|D3DFVF_DIFFUSE);
sDevice->SetStreamSource(0,pVertexBuffer,0,sizeof(tVertex));
D3DXMatrixRotationY(&matRotate, D3DXToRadian(fRotate));
D3DXMatrixTranslation(&matTranslation, 0.0f,0.0f,6.0f);
matWorld = matRotate * matTranslation;
sDevice->SetTransform(D3DTS_WORLD, &matWorld);
sDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, 0,2);
sDevice->EndScene();
fRotate -= 1.0f;
sDevice->Present( NULL, NULL, NULL, NULL );