Archived

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

IFooBar

vertex buffer....indexbuffer??????

Recommended Posts

IFooBar    906
hi could someone explain the deal with indexbuffers.........i know they have something to do with vertexbuffers, but ........um.......thats where u guys come in thanks

Share this post


Link to post
Share on other sites
Shadows    133
Well it''s actually quite easy, vertexbuffers stores vertices and index buffer stores indices. I suppose that wasn''t very helpful so I guess that I should explain what indices are and what they''re used for.

You probably already know that vertices are different points in triangles if you use Triangle lists you have to have 3 vertices (3 points) for each triangle if you use triangle strips or fans (don''t use fans) you have 3 vertices + Xvertices where X is the amount of triangles - 1.

In particular when you use triangle lists this creates an awful lot of unuseful points for example a cube would require 36 points to form the 12 triangles (2 for each side).

The use of indices is to store a reference to a vertex for example the cube with the 36 points, we all know that a cube only has eight corners instead of storing 36 individual vertices store the 8 corner vertices and combine them in the order specified by the index buffer to create 3 individual vertices.

Hope this will help.
// Fredrik Nilsson

PS. I''d suggest that you study the subject a bit more, if you''re using c++ try DrunkenHyena.com or nexe.gamedev.net if you''re a VB programmer check out www.vbexplorer.com/directx4vb/. For c++ users I might add that Dx4Vb is also worth a look, the language isn''t the same but the theory is and the language is quite easily translated. DS.

Share this post


Link to post
Share on other sites