GLCLEAR(3G)

πŸ“¦ version 24.3.3, in opensuse-leap 16.0

πŸ’… GLCLEAR(3G) β€” clear buffers to preset values πŸ’…

✨ NAME ✨

glClear - clear buffers to preset values, bestie. That’s the whole vibe.


πŸ’» C SPECIFICATION πŸ’»

void glClear( GLbitfield mask )

πŸŽ€ PARAMETERS πŸŽ€

  • mask β€” Bitwise OR of masks that tell glClear which buffers to clear. The four masks are GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, GL_ACCUM_BUFFER_BIT, and GL_STENCIL_BUFFER_BIT. No cap, that’s the whole menu.

🌸 DESCRIPTION 🌸

Okay so glClear sets the bitplane area of the window to values that were previously selected by glClearColor, glClearIndex, glClearDepth, glClearStencil, and glClearAccum. Multiple color buffers can be cleared simultaneously by selecting more than one buffer at a time using glDrawBuffer. Iconic multitasking behavior, honestly.

The pixel ownership test, the scissor test, dithering, and the buffer writemasks affect how glClear operates. The scissor box bounds the cleared region. Meanwhile, alpha function, blend function, logical operation, stenciling, texture mapping, and depth-buffering are ignored by glClear. They’re literally not invited to this party.

glClear takes a single argument that is the bitwise OR of several values indicating which buffer is to be cleared. One argument, many buffer vibes.

The values are as follows:

  • GL_COLOR_BUFFER_BIT β€” indicates the buffers currently enabled for color writing.
  • GL_DEPTH_BUFFER_BIT β€” indicates the depth buffer.
  • GL_ACCUM_BUFFER_BIT β€” indicates the accumulation buffer.
  • GL_STENCIL_BUFFER_BIT β€” indicates the stencil buffer.

The value to which each buffer is cleared depends on the setting of the clear value for that buffer. So yes, the clear value is the main character here.


πŸ¦‹ NOTES πŸ¦‹

If a buffer is not present, then a glClear directed at that buffer has no effect. It’s giving β€œtried to clear a buffer that isn’t even here.”


πŸ’€ ERRORS πŸ’€

  • GL_INVALID_VALUE is generated if any bit other than the four defined bits is set in mask.
  • GL_INVALID_OPERATION is generated if glClear is executed between the execution of glBegin and the corresponding execution of glEnd. So don’t try to slide that in mid-glBegin/glEnd, bestie.

πŸ‘‘ ASSOCIATED GETS πŸ‘‘

  • glGet with argument GL_ACCUM_CLEAR_VALUE
  • glGet with argument GL_DEPTH_CLEAR_VALUE
  • glGet with argument GL_INDEX_CLEAR_VALUE
  • glGet with argument GL_COLOR_CLEAR_VALUE
  • glGet with argument GL_STENCIL_CLEAR_VALUE

🌈 SEE ALSO 🌈

glClearAccum(3G), glClearColor(3G), glClearDepth(3G), glClearIndex(3G), glClearStencil(3G), glColorMask(3G), glDepthMask(3G), glDrawBuffer(3G), glScissor(3G), glStencilMask(3G) β€” the whole friend group, fr fr.


Cute sign-off time: this is the GLCLEAR(3G) manual page, and the footer doesn’t give us any extra source/version/date info beyond that manual tag β€” so that’s the whole footer vibe. Slay, clear those buffers, and stay iconic. πŸ’…βœ¨

πŸ“¦ where this page comes from