PDA

View Full Version : Orienting the camera without gluLookAt



Marmotte
12-09-2002, 11:26 AM
How can I oriente the camera (modify the projection matrix) without gluLookAt ?

fritzlang
12-09-2002, 11:34 AM
glRotatef();
glTranslatef();

Marmotte
12-09-2002, 11:40 AM
Could you give me an example, because I try this method.
As an example:

glMatrixMode(GL_PROJECTION);
glTranslatef(0.0F, 0.0F, 5.0F);
// I move the camera away from the object

should have the same effect than:

glMatrixMode(GL_MODELVIEW);
glTranslatef(0.0F, 0.0F, -5.0F);
// I move the objet away from the camera

But it doesn't work and:

glMatrixMode(GL_PROJECTION);
glTranslatef(0.0F, 0.0F, -5.0F);

and

glMatrixMode(GL_MODELVIEW);
glTranslatef(0.0F, 0.0F, -5.0F);

render the same way. So I don't understand.



Originally posted by fritzlang:
glRotatef();
glTranslatef();

fritzlang
12-09-2002, 11:55 AM
glLoadIdentity();
glRotatef(360 -rot_x, 1, 0, 0);
glRotatef(360 -rot_y, 0, 1, 0);
glRotatef(360 -rot_z, 0, 0, 1);
glTranslatef(-pos_x, -pos_y, -pos_z);

// then draw objects here

This question, however, does not belong in the advanced opengl forum.

fritzlang.

[This message has been edited by fritzlang (edited 12-09-2002).]

JONSKI
12-09-2002, 01:35 PM
gluLookAt() modifies the projection matrix? This is news to me.

Coriolis
12-09-2002, 01:38 PM
gluLookAt post-multiplies the current matrix, whichever matrix that is.

Mazy
12-10-2002, 02:14 AM
And never put the translations or glulookat into the projection matrix.