GLCLEAR(3G)
π 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 tellglClearwhich buffers to clear. The four masks areGL_COLOR_BUFFER_BIT,GL_DEPTH_BUFFER_BIT,GL_ACCUM_BUFFER_BIT, andGL_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_VALUEis generated if any bit other than the four defined bits is set inmask.GL_INVALID_OPERATIONis generated ifglClearis executed between the execution ofglBeginand the corresponding execution ofglEnd. So donβt try to slide that in mid-glBegin/glEnd, bestie.
π ASSOCIATED GETS π
glGetwith argumentGL_ACCUM_CLEAR_VALUEglGetwith argumentGL_DEPTH_CLEAR_VALUEglGetwith argumentGL_INDEX_CLEAR_VALUEglGetwith argumentGL_COLOR_CLEAR_VALUEglGetwith argumentGL_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
- opensuse-leap 16.0: Mesa-libGL-devel 24.1.7-160000.3.1 Β· MIT
- opensuse-leap 16.0: Mesa-libGL-devel 24.3.3-160000.3.1 Β· MIT
- opensuse-leap 16.0: Mesa-libGL-devel 24.3.3-160000.3.1 Β· MIT
- opensuse-leap 16.0: Mesa-libGL-devel 24.3.3-160000.3.1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms