GLULOOKAT(3G)

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

πŸ’… 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