Original Post
Hello! I want to draw a rectangle (with fill) using DirectX 9c and I have a stupid problem... If I am using TriangleStrips or Triangles Fans it's rendered only one triangle, not two. The code is below. Do you have any suggestions ? struct VERTEX_FLAT { float x,y,z; float rhw; D3DCOLOR color; }; #define D3DFVF_FLAT (D3DFVF_XYZRHW | D3DFVF_DIFFUSE ) // define three corner vertices VERTEX_FLAT v[4]; v[0].x = 0; v[0].y = 0; v[0].color = 0xFF0000FF; // the blue corner v[1].x = 300; v[1].y = 0; v[1].color = 0xFFFF0000; // the red corner v[2].x = 300; v[2].y = 300.0; v[2].color = 0xFF00FF00; // the green corner v[3].x = 0; v[3].y = 300.0; v[3].color = 0xAA00FF00; // the green corner v[0].z = v[1].z = v[2].z = v[3].z = 0.0; // z buffer - paint over everything v[0].rhw = v[1].rhw = v[2].rhw = v[3].z = 1.0; // no perspective pd3ddev->BeginScene(); // set some render and stage states (you have to set some more, normally) pd3ddev->SetRenderState(D3DRS_ALPHABLENDENABLE,FALSE); pd3ddev->SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_DIFFUSE); pd3ddev->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_SELECTARG2); // now draw the triangle pd3ddev->SetFVF(D3DFVF_FLAT); pd3ddev->DrawPrimitiveUP(D3DPT_TRIANGLEFAN,2,(LPVOID)v,sizeof(VERTEX_FLAT)); pd3ddev->EndScene();