In this thread. The second answer suggest that :
Solution 2 call the
gluUnproject
two time, one withclipZ = -1
and another one withclipZ = 1
, you get two point (in world space). With these two point you get a ray and you can use some raycast algorithm to compute the mouse coordinate.
But unfortunately it is not explained there after the suggestion.
There is also this thread which explains a direction can be get by calling gluUnproject
twice. Getting a direction makes sense to me but my question is how can I get the depth info by calling gluUnProject
twice?