glLookAt or glRotate & glTranslate for 3-D views?

Started by
2 comments, last by BigBoy 21 years, 1 month ago
Is it quicker to move around a 3-D scene by changing the values in glLookAt or by rotating & translating from the identity at the start drawing the scene? WRT a 10,000 x 10,000 height mapped landscape (or something bigger), will scene redrawing time be reduced significantly if calculations are done to determine whether the section of landscape about to be drawn is out of FOV? Or should all this be left to OpenGL to worry about? Jeroen
Cheers,Jeroen
Advertisement
As for gluLooakAt, or glTranslate / glRotate, I think gluLookAt performs those operations anyway...

You would definitely want to check if a piece of the landscape is in the frustum, by yourself! Don't let OpenGL do it, because that means that you're still passing the calls like glVertex, glDrawElements, etc. through the pipeline. But if you don't at all draw whatever is outside the view frustum performance can increase by amazing amounts! This is called frustum culling. There are good tutorials on this at
gametutorials.com

You might also want to look into occlusion culling; removing things that are inside the frusum, but still hidden from view.

[edited by - James Trotter on March 4, 2003 9:23:08 AM]
quote:Original post by James Trotter

...stuff snipped....

But if you don''t at all draw whatever is outside the view frustum performance can increase by amazing amounts! This is called frustum culling. There are good tutorials on this at
gametutorials.com

You might also want to look into occlusion culling; removing things that are inside the frusum, but still hidden from view.


Thanks James. This should give me a few weeks or so of experimenting and learning.

Jeroen
Cheers,Jeroen
gluLookAt is not going to make any difference if you''re simply setting up the scene at the start of each frame. You still need to load the indentity and then it pretty much does the same thing.
If you''re going to be doing massive amounts of matrix changes then glTranslatef/glRotatef is supposed to be slightly faster, but even then it shouldn''t matter much. It''s mainly a matter of convenience that determines which one you use.
I set up the camera with gluLookAt and then position models and such with translate/rotate. It''s the easiest way for me to handle things.
_______________________________________Pixelante Game Studios - Fowl Language

This topic is closed to new replies.

Advertisement