PDA

View Full Version : gluLookAt and ModelView



Victor Hugo
05-25-2009, 07:10 AM
Hi All,

I'm having some problems getting my model view matrix, in order to use it with gluProject/gluUnproject

I set up my projection like this:

// change matrix mode
glMatrixMode(GL_PROJECTION);
// clears previous projection
glLoadIdentity();
glOrhtox(...)
// change matrix mode
glMatrixMode(GL_MODELVIEW);

after this calling

GLfixed model_view[16];
glGetFixedv(GL_MODELVIEW_MATRIX, model_view);

Gives me a identity matrix that is ok.

However inside my camera class I call

gluLookAtx(...) to some position

After this when I get the modelview I get same stange values that makes impossible to calculate it's inverse inside gluUnproject.

Any ideas ?

Thanks,

Victor

Victor Hugo
05-25-2009, 09:36 AM
Hi,

Fixed it by myself.

Problem was in vector normalizing.

Thanks anyway.