Archived

This topic is now archived and is closed to further replies.

BigBoy

glLookAt or glRotate & glTranslate for 3-D views?

Recommended Posts

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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites