View Full Version : CPU Time costs

06-29-2003, 03:56 PM
Does any one know how long a gluProject takes?

Basically, is 8 calls to gluProject going to take linger than throwing some trig. at a single point?

or should this be posted in the advanced forum?


06-29-2003, 11:15 PM
Probalby no one will care about this. Neither here or in the advanced. It is a common idea that timing individual function is useless.

06-30-2003, 01:52 AM
You can write loop with one & with another approach & check overall rendering time, but fn calls are not going to take you even 1% of time.

06-30-2003, 04:58 AM
I appreciate that the a fn call is fast, but how much cpu time does the fn itself consume?
This is going in the inner loops of my proggy, and so it's effects will be critical to the timing.

I 'spose I'll just have to build a test app to time it.

06-30-2003, 06:29 AM
gluUnProject is very inefficient to call in a loop if your modelview and projection matrix do not change within that loop. Because the total transformation (projection*modelview) is unchanged but gluUnProject 'seems' to be calculating that transformation, over and over again for each vertex.

Take look at the article http://www.medialab.chalmers.se/c2c/doc/aabbcull.html

"OpenGL 2D-to-3D Transformations" paragraph might help you implement what you need.

06-30-2003, 12:12 PM
"I 'spose I'll just have to build a test app to time it."

Bingo! Pre-mature optimization is almost always wrong. Build, *profile* to find bottlenecks if performance is a problem, and only then tweak the trouble spots.

Maybe things are different in graphics, but in IT I've seen plenty of people hack around in code they thought was slow, when all along they had forgotten to index their database tables.