GLCLIPPLANE(3G)

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

πŸ’… GLCLIPPLANE πŸ’…

okay bestie, welcome to glClipPlane(3G) β€” the manual page that's literally about slicing your geometry with extra planes. sit down, grab a strawberry πŸ“, and let's get into it.


✨ NAME ✨

glClipPlane β€” specify a plane against which all geometry is clipped. yes, that's the whole vibe. it's giving βœ‚οΈ but make it 3D.


🌸 C SPECIFICATION 🌸

void glClipPlane( GLenum plane,
                  const GLdouble *equation )

copy that exactly, don't freestyle the signature, i'm watching πŸ‘€


πŸŽ€ PARAMETERS πŸŽ€

  • plane β€” which clipping plane you're positioning, bestie. you use the symbolic names that look like GL_CLIP_PLANEi, where i is an integer between 0 and GL_MAX_CLIP_PLANESβˆ’1. those are the only accepted ones, periodt.
  • equation β€” the address of an array of four double-precision floating-point values. these four get interpreted as a plane equation. four. not three. not five. four, iykyk. 🫢

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea. geometry is always clipped against the boundaries of a six-plane frustum in x, y, and z β€” that's just the baseline, no cap. but glClipPlane lets you specify additional planes, and they don't even have to be perpendicular to the x, y, or z axis. anything goes. all your geometry gets clipped against them too.

wanna know the max number of extra clipping planes you can have? call glGetIntegerv with argument GL_MAX_CLIP_PLANES. literally every implementation supports at least six of these extra clipping planes, so you're covered. and because the resulting clipping region is the intersection of all the defined half-spaces, it's always convex. always. iconic behaviour tbh.

now, glClipPlane specifies a half-space using a four-component plane equation. when you call glClipPlane, equation gets transformed by the inverse of the modelview matrix and stored in the resulting eye coordinates. and listen β€” subsequent changes to the modelview matrix have no effect on the stored plane-equation components. it's locked in, bestie. πŸ”’

here's the vibe check: if the dot product of the eye coordinates of a vertex with the stored plane equation components is positive or zero, that vertex is in with respect to that clipping plane. otherwise, it's out. that's the whole test. slay.

to enable and disable clipping planes, call glEnable and glDisable with the argument GL_CLIP_PLANEi, where i is the plane number. simple as that.

and fun fact: all clipping planes are initially defined as (0, 0, 0, 0) in eye coordinates and are disabled. they're asleep. let them rest 😴


⭐ NOTES ⭐

it is always the case that GL_CLIP_PLANEi = GL_CLIP_PLANE0+i. always always. write it down. put it on your wall. 🧚


πŸ’€ ERRORS πŸ’€

heads up, these will ruin your day if you're not careful.
  • GL_INVALID_ENUM is generated if plane is not an accepted value. so like… use the right enum, babe. πŸ™ˆ
  • GL_INVALID_OPERATION is generated if glClipPlane is executed between the execution of glBegin and the corresponding execution of glEnd. don't do that. that's a crime in this house. 😭

πŸ”₯ ASSOCIATED GETS πŸ”₯

  • glGetClipPlane
  • glIsEnabled with argument GL_CLIP_PLANEi

πŸ‘‘ SEE ALSO πŸ‘‘

  • glEnable(3G)

and that's the page, bestie! πŸŽ€ this was GLCLIPPLANE(3G) in all its glory β€” official documentation energy, group chat delivery. go clip something cute. bye diva! πŸ’–βœ¨πŸŒˆ

πŸ“¦ where this page comes from