deshan

10-14-2011, 05:53 AM

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.

Could you please assist me?

Thank you

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.

Could you please assist me?

Thank you