gluLookAt vs. glRotatef/glTranslatef...etc
Im trying to create a camera class. Half the tutorials i have seen use gluLookAt, and the other half simply use glRotate and glTranslate.
Are there any major disadvantages or advantages of using one or the other?
Are there any major disadvantages or advantages of using one or the other?
There was a long silence...
'I claim them all,' said the Savage at last.
i think thats apples & oranges. one deals with camera view, and the other with where you are drawing an item?
There is no visual difference between moving your view around and moving your objects around.
Imagine a cube in the middle of your screen. If your user hits the forward button you can either glTranslate that cube closer to the camera, or you can move your camera closer to the cube.
kinda like when you look outside of your car and the car next to you is going forwards sometimes it feels like your going backwards...
Imagine a cube in the middle of your screen. If your user hits the forward button you can either glTranslate that cube closer to the camera, or you can move your camera closer to the cube.
kinda like when you look outside of your car and the car next to you is going forwards sometimes it feels like your going backwards...
There was a long silence...
'I claim them all,' said the Savage at last.
That seems ineffective if you are drawing an actual scene, versus just say, one object. Would you rather adjust XX amount of objects to move forward/backward/up/down/left/right/sideways or just your camera?
the two are exactly equivalent. gluLookAt calls glMultMatrix, glRotate/glTranslate are equivalent to glMultMatrix with specialized matrices.
Personally, I find gluLookAt easier to think about, so I tend to use that. Other people feel differently, and use the other calls. It's all a matter of preference.
Personally, I find gluLookAt easier to think about, so I tend to use that. Other people feel differently, and use the other calls. It's all a matter of preference.
It's interesting that just by putting the Game Design thread at the top of the list, it automatically gets all the programming posts. (even ones that should have gone in Graphics and Audio programming). Is it because everyone's used to general programming being at the top, or just people being too lazy to look for the right thread to post in ?
moved to the OpenGL forum in Graphics & Audio programming
Sorry about that. I thought that since i was asking about the design/theory of a camera class it would be more appropriate in the other forum...
OSC: I kinda figured that would be the case. Thanks for the clarification.
OSC: I kinda figured that would be the case. Thanks for the clarification.
There was a long silence...
'I claim them all,' said the Savage at last.
Hangt5 Wrote:Are there any major disadvantages or advantages of using one or the other?
OneSadCookie Wrote:the two are exactly equivalent.
...I find gluLookAt easier to think about
One thing I would like to point out is that gluLookAt is good for one scene renders, but
when it comes to rotating your camera around a point glTranslatef and glRotatef are much
easyer to use...
I created an animation in OpenGL with a floor and six posts I would move foward and
look left then right, then move forward and look up parralel to one of the posts.
This took tons, and tons of lines of code just to get my camera to look left then right...
gluLookAt is much better for "placing" your camera while (my function) SetCamera was much
easyer rotating...
gluLookAt has to have a point by point place to look at while SetCamera can just rotate the camera with a rotate call, this makes rotating, in the look at part, a circle, while gluLookAt
has square...
OneSadCookie Wrote:It's all a matter of preference.
Not in a team job...
It's whatever works better for what your doing...
that's why I have about... four different self made camera functions... all for different
types of play.
But, yes, It is what you like best when it's just you.
more completely random noise from spike...
as I said, anything you can do with LookAt, you can do with Rotate and Translate. It is entirely a matter of preference, neither works better than the other.
as I said, anything you can do with LookAt, you can do with Rotate and Translate. It is entirely a matter of preference, neither works better than the other.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| OpenGL gluLookAt() not doing anything? | ene777 | 1 | 3,047 |
May 1, 2008 08:50 AM Last Post: ThemsAllTook |
|
| gluLookAt problem | vobla | 0 | 2,420 |
Sep 1, 2007 12:44 PM Last Post: vobla |
|
| Trouble with glRotatef() | anthony | 4 | 5,856 |
Sep 1, 2007 09:27 AM Last Post: Nevada |
|
| Problems with gluLookAt(); | ghettotek | 6 | 5,147 |
Feb 9, 2003 04:35 AM Last Post: ghettotek |
|
| when is 'glTranslatef()' reset? | sealfin | 5 | 4,451 |
Jan 13, 2003 07:39 AM Last Post: DoG |
|

