Archived

This topic is now archived and is closed to further replies.

shakazed

Difference between indexbuffer and trianglestrip???

Recommended Posts

Guest Anonymous Poster
An idex buffer holds the indicies of the verticies in a vertex buffer that you want to be drawn (and in which order to be drawn).

A Triangle strip is a way of drawing verticies (indexed or otherwise). Samething for triangle fans, point lists, line strips, and trianges. they are just a way of rendering the data.

-James

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites