GLUUNPROJECT4(3G)

πŸ“¦ version 1.1, in centos-stream 9, fedora 43, fedora 44

✨ NAME ✨

okay bestie, welcome to the 3G manual page for gluUnProject4 πŸ’– β€” the icon that maps window and clip coordinates to object coordinates. no cap, that’s the whole name-vibe: map window and clip coordinates to object coordinates. periodt. πŸ‘‘


πŸ’– C SPECIFICATION πŸ’–

here’s the signature exactly, character for character, because we do not play with prototypes, fr fr:

       GLint gluUnProject4( GLdouble winX,
                            GLdouble winY,
                            GLdouble winZ,
                            GLdouble clipW,
                            const GLdouble *model,
                            const GLdouble *proj,
                            const GLint *view,
                            GLdouble near,
                            GLdouble far,
                            GLdouble* objX,
                            GLdouble* objY,
                            GLdouble* objZ,
                            GLdouble* objW )

πŸŽ€ PARAMETERS πŸŽ€

  • winX, winY, winZ β€” specify the window coordinates to be mapped. window coords, bestie, the ones you wanna map. πŸͺŸβœ¨
  • clipW β€” specify the clip w coordinate to be mapped. yes, the w. we love a w. πŸ’…
  • model β€” specifies the modelview matrix (as from a glGetDoublev call). modelview tea β˜•
  • proj β€” specifies the projection matrix (as from a glGetDoublev call). projection tea β˜•
  • view β€” specifies the viewport (as from a glGetIntegerv call). viewport tea β˜•
  • near, far β€” specify the near and far planes (as from a glGetDoublev call). near/far planes, iconic. πŸŽ€
  • objX, objY, objZ, objW β€” returns the computed object coordinates. the outputs, the main characters, the returns. πŸ‘‘

🌸 DESCRIPTION 🌸

okay so gluUnProject4 maps the specified window coordinates winX, winY and winZ and its clip w coordinate clipW into object coordinates (objX, objY, objZ, objW) using model, proj and view. literally the reverse-glow-up pipeline. πŸ’…

clipW can be other than 1 as for vertices in glFeedbackBuffer when data type GL_4D_COLOR_TEXTURE is returned. not me being flexible with w, but yes. This also handles the case where the near and far planes are different from the default, 0 and 1, respectively. so if your near/far are not the default 0 and 1, it still eats. πŸ“

A return value of GL_TRUE indicates success; a return value of GL_FALSE indicates failure. so check that vibe check, bestie β€” success vs failure, no in-between. 😭

To compute the coordinates (objX, objY, objZ and objW), gluUnProject4 multiplies the normalized device coordinates by the inverse of model*proj as follows:

                           objX
                          ⎝objY⎠=INV(PM)⎝_______________βˆ’1⎠
                           objZ          _______________βˆ’1
                           objW           ____________βˆ’1
                                               clipW

INV() denotes matrix inversion. the math is mathing, periodt. πŸ”₯

gluUnProject4 is equivalent to gluUnProject when clipW is 1, near is 0 and far is 1. so if those are your settings, it’s giving same energy as gluUnProject. 🌈


πŸ’… NOTES πŸ’…

gluUnProject4 is available only if the GLU version is 1.3 or greater. no old-GLU crumbs, bestie β€” 1.3+ or nothing. πŸ‘‘

πŸ¦‹ SEE ALSO πŸ¦‹

  • glGet(3G)
  • glFeedbackBuffer(3G)
  • gluProject(3G)
  • gluUnProject(3G)

bye bestie πŸ’– that’s the whole gluUnProject4 moment from the 3G manual. the footer is just the manual tag β€” no extra source/version/date tea on this one β€” so consider this your cute sign-off. mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from