PDA

View Full Version : Triangles versus Quads



azcoder
12-07-2007, 09:57 AM
I am importing data from an obj model.

It is stored as quads.

Is there any performance hit to sending batches of GL_QUADS versus GL_TRIANGLES?

I want to avoid having to re-triangulate the faces.

BTW - I am using VBO, if that matters.

Thanks for any feedback....

Dark Photon
12-07-2007, 10:12 AM
I am importing data from an obj model. It is stored as quads.

Is there any performance hit to sending batches of GL_QUADS versus GL_TRIANGLES? I want to avoid having to re-triangulate the faces. BTW - I am using VBO, if that matters.

You're using VBOs, so presumably you care about vertex cache coherence and are using indexed primitives ordered appropriately (for example, using this (http://home.comcast.net/~tom_forsyth/papers/fast_vert_cache_opt.html)).

For a regular grid, unstripped QUADs vs. unstripped TRIs, seems QUADS would actually be a tiny bit better. TRIANGLES = 3 indices/tri, QUADS = 2 indicies/tri. However, in practice I've never been index list bandwidth limited, and ordered the same, you should get the same vertex cache performance, so probably doesn't matter much. One related plus for QUADs -- you can fit more triangles in a single batch using unsigned short indices (fast path), which may mean fewer batches.

Try both and see. Easy test.

azcoder
12-07-2007, 12:40 PM
Thanks - That is exactly the information I was looking for...

Dark Photon
12-07-2007, 01:36 PM
One related plus for QUADs -- you can fit more triangles in a single batch using unsigned short indices (fast path), which may mean fewer batches.
...if you're limited by the number of indices and not the length of your vertex arrays.