Optimizations

Okay, my engine is nearing beta stages and works fine (on my system anyways) =) and I’d like to begin some optimizations.

However, I can’t find in any books or online anywhere what is faster between these drawing types:

GL_TRIANGLES (once and every facet is 3 points)

or (if I want facets of variable point sizes)

GL_TRIANGLE_STRIP vs. GL_POLYGON
GL_TRIANGLE_STRIP vs. GL_QUAD_STRIP
GL_TRIANGLE_STRIP vs. GL_QUADS (for 4 vertex facets)

Thanks!
Jeff

From the NVIDIA OpenGL Performace FAQ v2:
From Fastest to Slowest:

GL_TRIANGLE_STRIP
GL_TRIANGLE_FAN
GL_QUAD_STRIP
These maximize reuse of the vertices shared within a given graphics primitive, and are all similarly fast.

GL_TRIANGLES
GL_QUADS
These aggregate (potentially multiple) disjoint triangles and quads, and amortize function overhead over multiple primitives.

GL_POLYGON
A bit slower than the independent triangles and quads.

Hope it helps. You can find the whole document on nvidia’s site, or in their NVSDK/docs/faqs

Actually triangle strip and quad strip is exactly the same because the hardware makes two triangles out of every quad you draw. Just think about it: You can exchange every GL_QUAD_STRIP in your program with GL_TRIANGLE_STRIP without changing anything else and the result won’t change.

Except may be texture coordinates.

I found out the disappointing way.

lobstah…

Only optimise if you know what the bottleneck is. If you’re fillrate limited it won’t bring much to optimise geometry throughput.

Get a decent profiler to find out what parts of your code are slow, ten optimise them.

Without a profiler, you can basically forget about optimizing. I prefer NuMega Boundschecker (although I don’t have it now, used to work with it 2 years ago - this program rocks!)

-Lev

I found BoundsChecker utterly useless as a…bounds checker - didn’t realise it was a profiler too.
The best profiler on the PC platform is vtune by intel, without question.

oops sorry of course I didn’t mean boundschecker, stupid me.

I meant TrueTime, the best profiler, yeah even better than vtune - also from NuMega (thats why I confused it with Boundschecker)

-Lev

BTW Boundschecker is everything but not useless!

I’ve used boundschecker before, and found it brill. Takes some understanding to use it properly.

I got an evaluation version a couple of months ago of the latest version of boundschecker - it’s full of bugs - not what you need when debugging code!
Anyway, I didn’t use the truetime thing, as I’m too used to vtune, maybe I should give it a chance, but I find vtune really useful.

OT but are any of these profiler programs free?
if so which ones?

None of there profilers is free, but there is an evaluation version of VTune availavle on inter’s website.

-Lev

Hey Zed, check out AMD CodeAnalyst, at http://www.amd.com/us-en/Processors/DevelopWithAMD/0,30_2252_3604,00.html

that ones is freely downloadable.