Choosing the best way

Hi guys! I’m making an OpenGL application and I got some questions about PERFORMANCE.

Is it better to do a single call to GL_TRIANGLES and make up an object with 24 vectors or a call to GL_TRIANGLES (with 6 vectors) plus a call to GL_QUADS (with 12 vectors)?

To clarify this question, I made up some Pictures.

This first one ( ) as you can see, is made up with a call to GL_TRIANGLES and a call to GL_QUADS. By adding the vectors I spend in both calls, we got 18.

This second one ( ), is made up with a single call to GL_TRIANGLES, but it spend 24 vectors.

So, what is the best way to choose? A single call with more vectors, or two calls with minus?

Thank you a lot guys!

[This message has been edited by Fernando (edited 06-19-2002).]

[This message has been edited by Fernando (edited 06-19-2002).]

How abouta triangle strip?

Yeaah! I tried that, but at a certain time, it’s impossible for me continue using TRIANGLE_STRIP. It’s cause i’m using Back Cull Face, and the object disappear deppending on the angle I’m looking to.

But wich of the two ways I described is higher?

I think you should use one strip and two individual triangles. Backface cull operates on a per-triangle basis, not a per-strip basis. If the whole thing is dissapearing, assume your triangles are being described the wrong way around.

a single triangle strip should work very simmple. its basically the same as a cube, with one side forgotten, and a cube you can unrol into one strip as well.

i’ll try it at home.

Thank you a lot guys!

But referring to the example I showed in my first message, Wich would give me the best result talking about performance?

depending on driver/gpu you wont even notice a difference… i dont know really wich one would win. best is, you compile this tiny object into a display list. then it doesn’t mather anymore as the driver can optimize it (if it cares…). so what?

At the small number of vertices you’re talking about, there should be no noticeable difference. You ought to be fill rate (and overhead!) bound at that level.

Once you start throwing around reasonably amounts of geometry, you will find it faster to submit geometry using vertex arrays and using DrawRangeElements(), and balance using as few calls to DrawRangeElements() as possible with sending as little data as possible across the bus (i e, the fewest verts).

If you’re still using a card that doesn’t have hardware transform, then the rules are slightly different, but only slightly. And at 24 verts, the number of verts or kinds of primitives will not matter even with software transform.