Hi
I am writing a opengl camera and I have a problem with this.
I move my camera using the simple function glTranslatef.
The problem is I have to give minus values for the upvalue to move the camera up.
For example.
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0f, (float)width/(float)height, 0.1f, 5000.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
// camera move
glTranslatef(x, y, z);
// rest of the drawing code comes here
// the transformation of all the game objects calculate using glMultMatrixf function
so if I give y as a minus value(-10) camera moves up and plus value (+10) camera moves down.
I do not know why.
You need to put the inverse of the camera transform onto the ModelView matrix stack before rendering. Since you have put glTranslatef(x,y,z); that is as though your camera is a (-x, -y, -z). You can use gluLookAt (or equivalent) to easily set up the inverse camera transformation.