Archived

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

aCeOfSpAdEs

Index Buffers

Recommended Posts

I have been using vertex buffers ever since I started with directx. I have Jim Adams book, (which is excellent), but it doesn''t say anything about index buffers. could someone tell me what they are, or point me to a good reference? thanks ----------------------------------------- when all else fails... crack open a cold one.

Share this post


Link to post
Share on other sites
Index buffers are ways to tell directx how to connect the dots (aka vertexes)

If you have polygons aligned like below,



0---1
| / |
2---3
| / |
4---5



Normally without index buffers, you would have to send 12 vertexes down the pipe (with DrawPrimative commands) to make all 4 triangles (3 sides per a triangle.) With index buffers, you send 6 vertexes down the pipe + 12 indexes. Indexes are usually smaller in size (2 bytes or 4 bytes) per index indead of vertex which can be much larger (32 bytes or larger.) Indexes is just an array telling directx how to connect the vertexes to construct the triangles. Above would have index values of : 0, 1, 2, 1, 3, 2, 2, 3, 4, 3, 5, 4 (that would make all the triangles)

This saves AGP bandwidth and you get a higher FPS.


[edited by - Joeyblow2 on July 2, 2003 11:22:15 AM]

Share this post


Link to post
Share on other sites
It also allows the video card itself to cache vertices and reuse the transform results, whereas when you send individual vertices, each vertex is only used once (excepting strips/fans), and thus there''s no way to cache them.

Share this post


Link to post
Share on other sites
While on this subject I''ll save creating another thread.

What happens to texture coordinates when vertices are indexed? For instance if the primitive example posted by JoeyBlow2 had different unique texture coordinates for each quad wouldn''t it mess up what''s supposed to be mapped to those quads?

Share this post


Link to post
Share on other sites