What the heck are Indices????,
Members - Reputation: 122
Posted 19 January 2000 - 02:22 AM
Suppose you have 4 D3DVERTEX vertices:
D3DVERTEX Verts. 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;
You''d set this array up as follows:
indices = 0; // Point at vertex
indices = 1; // point at vertex
indices = 2; // point at vertex
indices = 0; // point at vertex
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.