GLUCYLINDER(3G)

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

πŸ’– GLUCYLINDER β€” ok bestie, let's talk cylinders πŸ’–

This is the tea on gluCylinder, from the 3G manual section (that's the GLU / OpenGL Utility library corner of the man pages, iykyk). Strap in, we're drawing a whole cylinder. πŸŽ€


✨ NAME ✨

gluCylinder β€” draw a cylinder. That's it, that's the whole job. Iconic behavior, honestly. πŸ¦‹


🧚 C SPECIFICATION 🧚

void gluCylinder( GLUquadric* quad,
                  GLdouble base,
                  GLdouble top,
                  GLdouble height,
                  GLint slices,
                  GLint stacks )

Look at her. Six whole arguments. She's lowkey high maintenance but she delivers. πŸ’…


🌸 PARAMETERS 🌸

  • quad β€” the quadrics object, aka the whole vibe holder. You gotta make it first with gluNewQuadric. No object, no cylinder, periodt.
  • base β€” the radius of the cylinder down at z = 0. This is the bottom's moment. πŸ“
  • top β€” the radius of the cylinder up at z = height. The glow-up at the top, fr.
  • height β€” how tall she is. Self-explanatory bestie, we love a straightforward parameter.
  • slices β€” how many subdivisions go around the z axis. Think of it like the number of vertical pizza cuts going around. More slices = smoother, but more work. ⭐
  • stacks β€” how many subdivisions go along the z axis. That's the vertical stacking, like pancakes. πŸ₯ž

πŸ‘‘ DESCRIPTION πŸ‘‘

gluCylinder draws a cylinder that's oriented along the z axis. The base of the cylinder sits at z = 0, and the top sits at z=height. And just like a sphere, the cylinder gets subdivided around the z axis into slices, and along the z axis into stacks. Same energy as gluSphere, different shape.

πŸ’€ Okay so important note: if you set top to 0.0, this routine does NOT give you a cylinder anymore β€” it generates a cone. That's not a bug, that's just math being math. Set your radius to zero, get a pointy situation. Adjust expectations accordingly, bestie.

Now, about normals β€” the way your lighting looks depends on this:

  • If the orientation is set to GLU_OUTSIDE (you do that with gluQuadricOrientation), then any generated normals point away from the z axis. Outward vibes. 🌈
  • Otherwise, they point toward the z axis. Inward vibes.

And if texturing is turned on (that's gluQuadricTexture doing the lord's work), then texture coordinates get generated like this, and I need you to pay attention because there are numbers:

  • t ranges linearly from 0.0 at z = 0 to 1.0 at z = height. Bottom to top, a clean little gradient.
  • s ranges from 0.0 at the +y axis, to 0.25 at the +x axis, to 0.5 at the -y axis, to 0.75 at the -x axis, and back to 1.0 at the +y axis. Full lap around the cylinder, quarter turns at each axis. πŸŒ€

🫢 SEE ALSO 🫢

Go read these next, they're all part of the same quadrics friend group:

  • gluDisk(3G)
  • gluNewQuadric(3G)
  • gluPartialDisk(3G)
  • gluQuadricTexture(3G)
  • gluSphere(3G)

And that's the whole page, bestie!! πŸ’– This was GLUCYLINDER(3G) β€” yes, the same name as the title, they really said "consistency" β€” straight out of the 3G manual, brought to you by the OpenGL-adjacent powers that be. Go forth and draw something tubular (literally, it's a cylinder). Slay. πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from