Glu.UnProject4 (gb.opengl.glu)

Static Function UnProject4 ( WindowX As Float, WindowY As Float, WindowZ As Float, ClipW As Float, Modelview As Float[], Projection As Float[], Viewport As Integer[], NearValue As Float, FarValue As Float ) As Float[]

Map window and clip coordinates to object coordinates.

Parameters

winX, winY, winZ

Specify the window coordinates to be mapped.
clipW

Specify the clip w coordinate to be mapped.
model

Specifies the modelview matrix (as from a Gl.GetDoublev call).
proj

Specifies the projection matrix (as from a Gl.GetDoublev call).
view

Specifies the viewport (as from a Gl.GetIntegerv call).
nearVal, farVal

Specifies the near and far planes (as from a Gl.GetDoublev call).
objX, objY, objZ, objW

Returns the computed object coordinates.

Description

Glu.UnProject4 maps the specified window coordinatesi: winX, winY, and winZ and its clip w coordinate clipW into object coordinates objX objY objZ objW using model, proj, and view. clipW can be other than 1 as for vertices in Gl.FeedbackBuffer when data type Glu.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 Glu.TRUE indicates success; a return value of Glu.FALSE indicates failure.

To compute the coordinates objX objY objZ objW , Glu.UnProject4 multiplies the normalized device coordinates by the inverse of model proj as follows:

objX objY objZ objW INV P M 2 winX - view 0 view 2 - 1 2 winY - view 1 view 3 - 1 2 winZ - nearVal farVal - nearVal - 1 clipW

INV denotes matrix inversion.

Glu.UnProject4 is equivalent to Glu.UnProject when clipW is 1, nearVal is 0, and farVal is 1.

Notes

Glu.UnProject4 is available only if the GLU version is 1.3 or greater.

See also

Glu.Project Glu.UnProject Gl.FeedbackBuffer Gl.Get

See original documentation on OpenGL website