As the title indicates i’m getting a false value returned and my object x,y,z values remain unwritten to.
I’ve looked on the net but can’t find anywhere the possible reasons that could cause the function to return false and/or any common errors that tend to occur.
Could someone point me in the right direction or offer advice that would help me in debugging my error?
Weird. Maybe it can’t invert the matrix? Are you sure you pass the correct parameters? Maybe looking at the source of Mesa or the SGI OpenGL sample implementation for the function gluUnProject can point you to the right direction.
Cheers for the help guys, believe it or not but when i changed my near and far z distances in gluPerspective from 0 and 1 to 1 and 200 it started working. Any idea why? A lesson well worth learning i think.
Think harder. Setting zNear=0 means, the eye is located in the near clip plane. The plane degenerates to a single point. Obviously the area is 0. How can you map world coords onto a plane, that has no area? You can’t.