Skip to main content
gamedev.net
🔒 Locked

Difference between indexbuffer and trianglestrip???

Started by shakazed 2 replies 900+ views
CountOfMonteChristo
CountOfMonteChristo
Triangle strips and index buffers both use a list of vertices: With triangle strips, the first three vertices define the first triangle, and every vertex after that is combined with the two preceding vertices to make a new triangle. As a result, all triangles are connected to each other in a long strip.

index buffers, however, define which vertices in each list to use per triangle. If we take a cube, for instance, you''d have a list of eight vertices (one for each corner of the cube):

0 - Vertex 1
1 - Vertex 2
2 - Vertex 3
3 - Vertex 4
4 - Vertex 5
5 - Vertex 6
6 - Vertex 7
7 - Vertex 8

And then a list of indices, three per triangle. So for instance 0 1 2 0 3 1 4 5 6 4 7 5 would draw four triangles: the first at vertices 0, 1 and 2, The second at 0, 3, and 1, the third at 4, 5 and 6, and the last at 4, 7 and 5.

As you can see, the triangles do not necessarily need to be connected to each other, as opposed to triangle strips.

See DirectX Graphics -> Programmer''s Guide -> Using Direct3D -> Vertex Data -> Device Supported Primitive Types for an explanation of triangle strips and fans, and DirectX Graphics -> Programmer''s Guide -> Advanced Topics -> Object Geometry -> Index Buffers for an explanation of Index Buffers.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.