Maps window and clip coordinates to object coordinates.
A return value of GL_TRUE indicates success; a return value of GL_FALSE indicates failure.
gluUnProject4 maps the specified window coordinates winX, winY and winZ and its clip w coordinate clipW into object coordinates (objX, objY, objZ, objW) using modelMatrix, projectionMatrix and viewport. clipW can be other than 1 as for vertices in glFeedbackBuffer when data type GL_4D_COLOR_TEXTURE is returned. This also handles the case where the nearVal and farVal planes are different from the default, 0 and 1, respectively. A return value of GL_TRUE indicates success; a return value of GL_FALSE indicates failure.
To compute the coordinates (objX, objY, objZ and objW), gluUnProject4 multiplies the normalized device coordinates by the inverse of modelMatrix multiplied by projectionMatrix as follows:
( 2(winX - viewport[0] ) | ---------------- - 1 | | viewport[2] | | | | 2(winY - viewport[1] | ( objX ) | ---------------- - 1 | | objY | = INV(PM) * | viewport[3] | | objZ | | | ( objW ) | 2(winZ - nearVal) | | -------------- - 1 | | farVal - nearVal | | | ( clipW )
INV() denotes matrix inversion.
gluUnProject4 is equivalent to gluUnProject when clipW is 1, nearVal is 0 and farVal is 1.
gluUnProject4 is available only if the GLU version is 1.3 or greater.
Glu Class | Tao.OpenGl Namespace | glFeedbackBuffer | glGetDoublev | glGetIntegerv | gluProject | gluUnProject