View Full Version : Rotating camera / scene
03-21-2001, 03:52 AM
What the most fast to do for best performances ? To Rotate Camera around a 3D world or to do a rotation of the scene around the camera.....
The different is in the calcul of matrix.....but I don't know which take more time to make matrix....
Don't you bother about that. We are talking about saving a second of computation time per month of runtime or so (well, I hope you understand what I mean).
And to be correct, there is no camera in OpenGL that you can move. There is one viewpoint you can see as a camera, but that viewpoint is fixed at the origin, and when you "move the camera" you are actually moving the scene instead. So whatever way you choose, you will end up doing the same thing, moving the scene.
03-21-2001, 05:20 AM
I think there does be a camera because you can you gluLookAt() function to change your viewing pose.
Well, newname, Bob is right !
There is no camera in OpenGL and using gluLookAt will "simulate" a camera by calculating the proper transformation matrix using the parameters you supply.
03-21-2001, 06:09 AM
Yes right bob.
When I spoke of camera, i'm using gluLookAt() for moving view...
In this time I'm not use low-level OpengL BUT THE gLUT.
It is right it is a viewpoint and not a camera. But if the scene contains much objects to draw, maybye, to modify gluLookAt() parameters or scene position will be more fast ?
The number of matrix calcul is different !
Wether you use gluLookAt or move the scene does not matter. It's the same thing. gluLookAt moves/rotates the scene in the proper direction. This is only done once each frame, and however you do it, it will result in one matrix. And what this matrix looks like or how it's calculated is kindof irrelevant, because matrix-vertex multiplication is always the same.
My advice is: Forget about it. As I stated above, you won't notice anything, I can guaratee that. Use the methid that fits your needs best.
03-22-2001, 07:12 AM
A lot of times it useful to think of having a movable camera to view your world, espiecally if the camera's "location" is essentially the user's location. You could create a camera class and provide wrappers for the glRotate and glTranslate and whatever else, just make sure you keep your order of operations correct, because everything becomes backwards when you start looking at it as moving the camera around a scene versus moving the scene around the camera.
Edit: Kinda off topic here I guess since the question was about performance. Performance is a non-issue here, since however you choose to look at it you are still just building the matrix that will translate and rotate geometry as it is passed to OpenGL.
[This message has been edited by GHoST (edited 03-22-2001).]
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.