I'm running into a bottleneck where I'm drawing many basic disconnected colored triangle strips in DirectX 9 (XNA). The problem comes with drawing them all in seperate draw calls, so I'd like to batch them all together into a single buffer and draw them in one draw call.

I understand that in DirectX10 and above, there's a way to draw many triangle strips in the same draw call by inserting a special "cut" index (-1) into the index buffer after every line strip.

Is there a way to do this without the use of the cut index? (Which as far as I know, isn't present in directx 9?)


If the triangle strips, while being disconnected, are all sharing the same material (shaders, textures, shader constants) then you can join them together with a degenerate triangle. Since degenerate triangles have zero area they should not show up. The only case they would is if you are drawing wireframe.

You make a degenerate triangle by defining the two of the three vertices as being the same. This is a bit complicated in triangle strips where you only use two vertices to define each triangle.

Look at the following diagram:

enter image description here

Triangle strip A,B,C is connected with triangle strip E,F via a degenerate triangle D. Triangle D would be defined as two points of C, then two points of E. In this way it is a zero-area triangle, but it is still connected.

You can find information on this stack overflow article where the wireframe problem is illustrated.

| improve this answer | |
  • \$\begingroup\$ Thanks, this worked perfectly! I thought that even degenerate triangles would get passed to the fragment shader and produce a line, but apparently not. \$\endgroup\$ – mklingen Jan 11 '15 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.