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!

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!

glRotate( 0.0, 1.0, 0.0, angle); should do just fine.

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?

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:

//rotate camera



Aaah right got ya thanks :slight_smile: I thought ppl talked about a camera, as in creating a camera object or something, didn’t realise it was virtual talk :slight_smile: tanks for help man