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