# Glu.UnProject (gb.opengl.glu)

Static Function UnProject ( WindowX As Float, WindowY As Float, WindowZ As Float, Modelview As Float[], Projection As Float[], Viewport As Integer[] ) As Float[]

Map window coordinates to object coordinates.

### Parameters

winX, winY, winZ

Specify the window coordinates 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).
objX, objY, objZ

Returns the computed object coordinates.

### Description

Glu.UnProject maps the specified window coordinates into object coordinates using model, proj, and view. The result is stored in objX, objY, and objZ. A return value of Glu.TRUE indicates success; a return value of Glu.FALSE indicates failure.

To compute the coordinates $\left(\mathit{objX},\mathit{objY},\mathit{objZ}\right)$, Glu.UnProject multiplies the normalized device coordinates by the inverse of model proj as follows:

$\left(\begin{array}{c}\mathit{objX}\\ \mathit{objY}\\ \mathit{objZ}\\ \mathit{W}\end{array}\right)\mathit{INV}\left(\mathit{P}\mathit{M}\right)\left(\begin{array}{c}\frac{2\left(\mathit{winX}-\mathit{view}[/0]\right)}{\mathit{view}[/2]}-1\\ \frac{2\left(\mathit{winY}-\mathit{view}[/1]\right)}{\mathit{view}[/3]}-1\\ 2\left(\mathit{winZ}\right)-1\\ 1\end{array}\right)$

$\mathit{INV}$ denotes matrix inversion. W is an unused variable, included for consistent matrix notation.

Glu.Project Gl.Get

See original documentation on OpenGL website