#### Archived

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

# What the heck are Indices????

This topic is 6576 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I just cant figure out what indices are, Im trying to implement a Vertex Buffer, and wanted to use DrawIndexedPrimitive(or something similar) but can not figure out what indiceas are! PLEASE HELP!!!! THANK YOU SOOOO MUCH!!!!

##### Share on other sites
don''t take my word as gospel since i don''t konw much d3d but that''s for drawing a primitive in a list of verticies. just use DrawPrimitive instead.
i think that''s what u were asking anyways

##### Share on other sites
The worlds Im using have lots of Points sharing the same spot which would increase Transform speed I believe. Thats why I want to know what they are.

##### Share on other sites
In short, "indices" are an array of unsigned short ints. The value of each index is an index into the array of D3DVERTEX.

Suppose you have 4 D3DVERTEX vertices:
D3DVERTEX Verts[4]. Suppose #0 and #3 are at the same point.
If you use drawprimitive, you just pass the verts and the number of verts and it uses them all, you can''t take advantage of the fact that #0 and #3 are equivalent, it just blindly goes thru them.

If you use DrawIndexedPrimitive, you need an array of unsigned short ints, one for each vertex in your geometry:
unsigned short int indices[4];
You''d set this array up as follows:
indices[0] = 0; // Point at vertex[0]
indices[1] = 1; // point at vertex[1]
indices[2] = 2; // point at vertex[2]
indices[3] = 0; // point at vertex[0]

Now you only need to pass 3 vertices to DrawIndexedPrimitive, because only the first 3 are used. The redundant ones have been filtered out. Of course you''d use this fact when you built your Verts[] array in the first place (You wouldn''t have put point #4 in it at all). If your scene has a ton of shared vertices (to be shared they have to have the same texture and texture coordinates (tu,tv)) you''ll be able to weed out alot more vertices than just one like in this example.

-ns-