OpenGL camera upside down problem

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.


gluPerspective(45.0f, (float)width/(float)height, 0.1f, 5000.0f);


// 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.

Could you please assist me?

Thank you

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.

The reason is that the “camera” in openGL is always at (0,0,0) and glTranslatef is actually moving the world around it.

So if you want to move the camera up relative to the world you must move everything else down.

Thought that was a wrong way.
Now I can undrstand wht really a camera is.
Thank you very much both of you.