Issue using degenerated triangles in DX9

07b9e9e8483468e4a0e1bac1843e6e74
0
Snoob 105 Apr 17, 2012 at 19:12 directx

Hi,

actually I try to render two connected triangle strips using DirectX 9 and degenerated
triangles but I fail, only the first strip is rendered:

Vertex vertices[] = {
        Vertex(-1.0f,  0.0f,  0.0f, 255,    0,   0, 255),  
        Vertex(-1.0f,  1.0f,  0.0f,   0,  255,   0, 255),
        Vertex( 0.0f,  0.0f,  0.0f,   0,    0, 255, 255),
        
        Vertex( 0.0f,  1.0f,  0.0f,   0,  255, 255, 255),
        Vertex( 1.0f,  0.0f,  0.0f,   0,  255,   0, 255),
        Vertex( 1.0f,  1.0f,  0.0f, 255,  255,   0, 255),

        Vertex( 1.0f,  1.0f,  0.0f, 255,  255,   0, 255),     //degenerated tris
         Vertex(-1.0f, -1.0f,  0.0f,   0,  255,  255, 255), //degenerated tris

        Vertex(-1.0f, -1.0f,  0.0f,   0,  255,  255, 255),
        Vertex(-1.0f,  0.0f,  0.0f, 255,    0,   0,  255),
        Vertex( 0.0f, -1.0f,  0.0f,  255,  255, 255, 255)
};

d3ddev->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 6);

If i understand this correctly, I’ve only add a degenerated
triangle to connect both strips:

http://msdn.microsof…v=vs.85%29.aspx

With OpenGL everything is working as expected, but with
DirectX is I could only render the first strip …

Thanks for any help.
Snoob

2 Replies

Please log in or register to post a reply.

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Apr 17, 2012 at 20:28

DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 6);
That will only draw the first six triangles, no? Which includes the first strip and the two you marked as degenerate, but none of the second strip. The total number of triangles in the vertex buffer is 9.

07b9e9e8483468e4a0e1bac1843e6e74
0
Snoob 105 Apr 17, 2012 at 20:34

Ahh thanks, Reedbetea. I was blink while I was totally fixed to my vertices
declaration …