DrawPrimitive or DrawIndexedPrimitive?

Started by
2 comments, last by steg 23 years, 4 months ago
Hi, DrawPrimitive or DrawIndexedPrimitive, what are the advantages, disadvantages? I guess rendering with DrawIndexedPrimitive would be quicker doing the vertex processing? Your thoughts are most welcome, Steve You can achieve anything if you want it badly enough.

If it isn't working, take a bath, have a think and try again...

Advertisement
Hmm .. this is probably a hard one to answer.

There are cases where either one will out perform the other.
Your best bet is to decide on how you want to store
your model information first.

The biggest performance increase from the two calls is
organising your vertex information to be in triangle
strips/fans - literally you get a single triangle
per vertex this way (after the first). In models for
veichles/characters etc - organising the information into
tri strips and passing through DrawPrimitive would
probably be a good idea.

With stuff where you can do major vertex re-use i.e. landscapes
using DrawIndexedPrimitive would probably be better - especially
if you can keep the vertex cache misses low. This is done by
organising your index list to perform as few vertex changes
per triangle as possible.

Overall the use of either call should give very similar
results.... maybe some benchmarking might be in order
for this ....

--
Code..reboot..code..reboot..sigh!
MrF.--Code..reboot..code..reboot..sigh!
Thanks,
The reason I asked was that I have seen some examples that use these methods in the same kind of scenario, for example, drawing a cube.

Cheers for your reply,
Steve


You can achieve anything if you want it badly enough.

If it isn't working, take a bath, have a think and try again...

If you have models which have the same indices but different vertices (ie the links between triangles are the same, but the models may have vertices in different positions) you can use the same index buffer. Indexed primitives are faster to light than nonindexed ones, and they are faster to transform.


Please state the nature of the debugging emergency.


sharewaregames.20m.com

This topic is closed to new replies.

Advertisement