GLULOOKAT(3G)
π GLULOOKAT β the 3G manual, bestie edition β¨
Okay so real talk: gluLookAt is that girl. She sets up your whole camera vibe β where you're looking from, what you're looking at, and which way is "up" (because apparently that's a decision you have to make now π). Manual section 3G, GLU library, let's go π
π¦ NAME π¦
gluLookAt β define a viewing transformation
πΈ C SPECIFICATION πΈ
void gluLookAt( GLdouble eyeX,
GLdouble eyeY,
GLdouble eyeZ,
GLdouble centerX,
GLdouble centerY,
GLdouble centerZ,
GLdouble upX,
GLdouble upY,
GLdouble upZ )
β¨ PARAMETERS β¨
eyeX,eyeY,eyeZβ where your eyeball is at, literally. This specifies the position of the eye point πcenterX,centerY,centerZβ the position of the reference point, aka the thing you're staring at, no cap.upX,upY,upZβ specifies the direction of the up vector. Yes you have to tell it which way is up. We've all been there π«Ά
π DESCRIPTION π
gluLookAt creates a viewing matrix derived from an eye point, a reference point indicating the center of the scene, and an UP vector. It's giving "camera setup but make it math." π₯
The matrix maps the reference point to the negative z axis and the eye point to the origin. When a typical projection matrix is used, the center of the scene therefore maps to the center of the viewport. Similarly, the direction described by the UP vector projected onto the viewing plane is mapped to the positive y axis so that it points upward in the viewport.
β οΈ Bestie listen. The UP vector must not be parallel to the line of sight from the eye point to the reference point. Don't do it. It's not that girl. π
Let
centerX β eyeX
F=βcenterY β eyeYβ
centerZ β eyeZ
Let UP be the vector (upX,upY,upZ).
Then normalize as follows: f=_____
UPβ²=______
Finally, let s=fΓUPβ², and u=sΓf.
M is then constructed as follows:
s[0] s[1] s[2] 0
M=βu[0] u[1] u[2] 0β
βf[0] βf[1] βf[2] 0
0 0 0 1
and gluLookAt is equivalent to glMultMatrixf(M); glTranslated (-eyex, -eyey, -eyez); β iconic behavior honestly π
π SEE ALSO π
glFrustum(3G)gluPerspective(3G)
That's the whole page, babe. Sending you the biggest forehead kiss ππ β this was GLULOOKAT(3G), from the 3G manual section, and the footer at the bottom of the original says exactly that too: GLULOOKAT(3G). Slay, go build a camera. β¨π§
π¦ where this page comes from
- centos-stream 9: gl-manpages 1.1-24.20190306.el9 Β· MIT and Open Publication
- fedora 43: gl-manpages 1.1-34.20190306.fc43 Β· Apache-2.0 AND HPND AND HPND-sell-variant AND MIT AND OpenPBS-2.3 AND SGI-B-2.0 AND W3C-19980720 AND X11
- fedora 44: gl-manpages 1.1-35.20190306.fc44 Β· Apache-2.0 AND HPND AND HPND-sell-variant AND MIT AND OpenPBS-2.3 AND SGI-B-2.0 AND W3C-19980720 AND X11
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms