View Full Version : Camera
08-08-2005, 11:22 AM
Hi, can anyone PLEASE explain how you can use glTranslate() and glRotate() to manipulate the camera? I thought those two functions are for tranforming objects? thanks!
08-08-2005, 11:25 AM
p.s. just an example that allows me to rotate my view on the spot full 360 rotation, i can kinda do that with gluLookAt() function, but i hear it's better to use tranformation functions. Thanks again!
08-08-2005, 11:51 AM
glRotate( 0.0, 1.0, 0.0, angle); should do just fine.
08-08-2005, 12:38 PM
hmmmm sorry that doesn't help me...
I have this code here...
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // clear screen and depth buffer
gluLookAt(0.0, 0.0, 10, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
glRotatef(30, 0.0, 0.1, 0.0);
from what i can see from my book here, that should rotate the camera view :confused: but obviously any code that follows after the glRotate() will be transformed, therefore my 3D cube being rotated and not the camera? Could you explain please?
08-08-2005, 02:22 PM
Don't try to rotate the camera...that's impossible.
Instead, try and realize the truth: there is no camera.
By rotating, say, 45 degrees before rendering anything, you've effectively rotated the camera 45 degrees.
any subsequent rotations after that will be in addition to your initial rotation.
You can use push()/pop() to save and restore the modelview matrix derived by doing your initial rotation before and after you render any objects.
a little something like this:
08-08-2005, 03:09 PM
Aaah right got ya thanks :) I thought ppl talked about a camera, as in creating a camera object or something, didn't realise it was virtual talk :) tanks for help man
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.