Tri's vs. Quads

I realize this question has likely been asked umpteen berdillion times, and answered back as many times, but is it quicker for open gl to draw triangles or quads?

I have hug objects made up of tri’s and quads, and I may get a better compression out of the file sizes if I convert everything to 1 type only.

Triangles

Opengl will convert your quads to triangles befor rasterisation anyway so its faster if they are triangles to begin with.

Zee

i havem’t actually tested it fully but to me there looks to be hardly any difference at all in speed

Thank you. I’ll give tri’s a shot and see what happens. =)

I find quads a hell of a lot faster to draw quads than tris. In the best case, i.e 2 calls to draw 2 seperate triangles vs 1 call to quad, quads run at least twice as fast. If you only call GL_TRIANGLES once then the difference is alot smaller but remember that to make a quad from 2 triangles requires 6 vertices instead of 4 which all need to be processed with lighting and transformation etc.

Originally posted by Tim Stirling:
…remember that to make a quad from 2 triangles requires 6 vertices instead of 4 which all need to be processed with lighting and transformation etc. [/b]

If you use triangle fan it only takes 4 vertices.

Well, I downloaded the NeHe particle sim that uses triangle stips to “speed it up”, i then changed it to quads and there was no performance hit…

I find that triangle-strips are a lot slower than quads with my setup but I know that strips should be faster so I use them. nickin- I know a fan only uses 4 vertices but in the topic it only says triangles.

Models are best drawn with Tri-strips but this messes up things like different textures. I want to know what the difference in speed is if I took a polygon with > 4 sides and turned it into a fan although it is already in nice triangles you are specifying an extra vertex for the centre and to close the fan up again which would probably make it slower. I have tested on my pc but my TNT2 doesn’t like fans much anyway so the tests were a bit useless.

surely its card dependant, as its the card that has to convert it?

all of this is a pointless argument, triangles are better than quads for a number of reasons, for are start they are always co-planar, so you’ll get less rendering errors.

In terms of drawing geometry, triangle strips ARE the fastest primitive. Ideally, draw all of your geometry with the smallest amount of function calls possible (ie, vertex arrays) because you’ll reduce the amount of overhead when calling functions. Converting a single quad to a triangle fan is a waste of time because they are the same thing and are both sending the same number of vertices to the card. You should be trying to batch up the geometry into more than one poly when you draw it. (ie, if you are using glBegin/glEnd , then you are not drawing stufff very efficiently). I’d say batching triangles and quads into seperate arrays and rendering them separately would be a fairly sensible solution.