Jump to content


Issue using degenerated triangles in DX9

directx

2 replies to this topic

#1 Snoob

    Member

  • Members
  • PipPip
  • 42 posts

Posted 17 April 2012 - 07:12 PM

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 Reedbeta

    DevMaster Staff

  • Administrators
  • 5340 posts
  • LocationSanta Clara, CA

Posted 17 April 2012 - 08:28 PM

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.
reedbeta.com - developer blog, OpenGL demos, and other projects

#3 Snoob

    Member

  • Members
  • PipPip
  • 42 posts

Posted 17 April 2012 - 08:34 PM

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





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users