PDA

View Full Version : Problem with gluUnProject



Aquileo
02-11-2004, 08:19 AM
I have this code:

GLdouble punCercaX, punCercaY, punCercaZ;
GLdouble punLejosX, punLejosY, punLejosZ;
glGetIntegerv(GL_VIEWPORT, viewport);
glGetDoublev(GL_MODELVIEW_MATRIX, mvmatrix);
glGetDoublev(GL_PROJECTION_MATRIX, prjmatrix);
gluUnProject((GLdouble)lPixelX,(GLdouble)lPixelY, 0.0f, mvmatrix,
prjmatrix, viewport, &punCercaX, &punCercaY, &punCercaZ);
puntoPresionadoCerca.x = (float) punCercaX;
puntoPresionadoCerca.y = (float) punCercaY;
puntoPresionadoCerca.z = (float) punCercaZ;


But I have a great problem because the values of puntoCercaX, puntoCercaY and puntoCercaZ is 0 the first time.

Why is this?
Do I forget anything?

Thank you very much

Aquileo
02-11-2004, 09:06 AM
I've discovered the reason.

I don't initialize various values

Anyway Thanks for all.
Josemi.