Gambas Documentation
Application Repository
Code Snippets
Compilation & Installation
Components
gb
gb.args
gb.cairo
gb.chart
gb.clipper
gb.complex
gb.compress
gb.crypt
gb.data
gb.db
gb.db.form
gb.db.mysql
gb.db.odbc
gb.db.postgresql
gb.db.sqlite2
gb.db.sqlite3
gb.dbus
gb.dbus.trayicon
gb.debug
gb.desktop
gb.desktop.gnome.keyring
gb.desktop.x11
gb.eval
gb.eval.highlight
gb.form
gb.form.dialog
gb.form.editor
gb.form.htmlview
gb.form.mdi
gb.form.print
gb.form.stock
gb.form.terminal
gb.gmp
gb.gsl
gb.gtk
gb.gtk.opengl
gb.gtk3
gb.gtk3.opengl
gb.gtk3.webview
gb.gui
gb.gui.opengl
gb.gui.qt
gb.gui.qt.ext
gb.gui.qt.opengl
gb.gui.qt.webkit
gb.gui.trayicon
gb.gui.webview
gb.hash
gb.highlight
gb.image
gb.image.effect
gb.image.imlib
gb.image.io
gb.inotify
gb.jit
gb.libxml
gb.logging
gb.map
gb.markdown
gb.media
gb.media.form
gb.memcached
gb.mime
gb.mysql
gb.ncurses
gb.net
gb.net.curl
gb.net.pop3
gb.net.smtp
gb.openal
gb.opengl
gb.opengl.glsl
gb.opengl.glu
Glu
AUTO_LOAD_MATRIX
BeginCurve
BeginSurface
BeginTrim
Build1DMipmaps
Build2DMipmaps
ClearColor
Color
CULLING
Cylinder
DeleteNurbsRenderer
Disk
DISPLAY_MODE
EndCurve
EndSurface
EndTrim
ErrorString
FILL
FLAT
INSIDE
INVALID_ENUM
INVALID_VALUE
LINE
LookAt
NewNurbsRenderer
NewQuadric
NONE
NURBS_MODE
NurbsCurve
NurbsProperty
NurbsSurface
Ortho2D
OUT_OF_MEMORY
OUTSIDE
PARAMETRIC_TOLERANCE
PartialDisk
Perspective
PickMatrix
POINT
Project
QuadricDrawStyle
QuadricNormals
QuadricOrientation
QuadricTexture
SAMPLING_METHOD
SAMPLING_TOLERANCE
SILHOUETTE
SMOOTH
Sphere
U_STEP
UnProject
UnProject4
V_STEP
GluNurb
GluQuadric
gb.opengl.sge
gb.openssl
gb.option
gb.pcre
gb.pdf
gb.poppler
gb.qt4
gb.qt4.ext
gb.qt4.opengl
gb.qt4.webkit
gb.qt4.webview
gb.qt5
gb.qt5.ext
gb.qt5.opengl
gb.qt5.webkit
gb.qt5.webview
gb.qt6
gb.qt6.ext
gb.qt6.opengl
gb.qt6.webview
gb.report
gb.report2
gb.scanner
gb.sdl
gb.sdl.sound
gb.sdl2
gb.sdl2.audio
gb.settings
gb.signal
gb.term
gb.test
gb.util
gb.util.web
gb.v4l
gb.vb
gb.web
gb.web.feed
gb.web.form
gb.web.gui
gb.xml
gb.xml.html
gb.xml.rpc
gb.xml.xslt
Controls pictures
Deprecated components
Developer Documentation
Development Environment Documentation
Documents
Error Messages
Gambas Playground
How To's
Language Index
Language Overviews
Last Changes
Lexicon
README
Search the wiki
To Do
Topics
Tutorials
Wiki License
Wiki Manual

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