GLAPI/glClearBuffer: Difference between revisions
Line 26: | Line 26: | ||
== Description == | == Description == | ||
'''glClearBuffer*''' clears the specified buffer to the specified value(s). If {{param|buffer}} is {{enum|GL_COLOR}}, | '''glClearBuffer*''' clears the specified buffer to the specified value(s). If {{param|buffer}} is {{enum|GL_COLOR}}, then the buffer to clear is an index into the {{apifunc|glDrawBuffers}} array. In this case, {{param|value}} points to a four-element vector specifying the R, G, B and A color to clear that draw buffer to. If {{param|buffer}} is one of {{enum|GL_FRONT}}, {{enum|GL_BACK}}, {{enum|GL_LEFT}}, {{enum|GL_RIGHT}}, or {{enum|GL_FRONT_AND_BACK}}, identifying multiple buffers, each selected buffer is cleared to the same value. Clamping and conversion for fixed-point color buffers are performed in the same fashion as {{apifunc|glClearColor}}. | ||
If {{param|buffer}} is {{enum|GL_DEPTH}}, {{param|drawBuffer}} must be zero, and {{param|value}} points to a single value to clear the depth buffer to. Only '''glClearBufferfv''' should be used to clear depth buffers. Clamping and conversion for fixed-point depth buffers are performed in the same fashion as {{apifunc|glClearDepth}}. | If {{param|buffer}} is {{enum|GL_DEPTH}}, {{param|drawBuffer}} must be zero, and {{param|value}} points to a single value to clear the depth buffer to. Only '''glClearBufferfv''' should be used to clear depth buffers. Clamping and conversion for fixed-point depth buffers are performed in the same fashion as {{apifunc|glClearDepth}}. |
Latest revision as of 18:21, 14 February 2013
Core in version | 4.6 | |
---|---|---|
Core since version | 3.0 |
glClearBuffer: clear individual buffers of the currently bound draw framebuffer
Function Definition
void glClearBufferiv(GLenum buffer, GLint drawBuffer, const GLint * value); void glClearBufferuiv(GLenum buffer, GLint drawBuffer, const GLuint * value); void glClearBufferfv(GLenum buffer, GLint drawBuffer, const GLfloat * value); void glClearBufferfi(GLenum buffer, GLint drawBuffer, GLfloat depth, GLint stencil);
- buffer
- Specify the buffer to clear.
- drawBuffer
- Specify a particular draw buffer to clear.
- value
- For color buffers, a pointer to a four-element vector specifying R, G, B and A values to clear the buffer to. For depth buffers, a pointer to a single depth value to clear the buffer to. For stencil buffers, a pointer to a single stencil value to clear the buffer to.
- depth
- The value to clear a depth render buffer to.
- stencil
- The value to clear a stencil render buffer to.
Description
glClearBuffer* clears the specified buffer to the specified value(s). If buffer is GL_COLOR, then the buffer to clear is an index into the glDrawBuffers array. In this case, value points to a four-element vector specifying the R, G, B and A color to clear that draw buffer to. If buffer is one of GL_FRONT, GL_BACK, GL_LEFT, GL_RIGHT, or GL_FRONT_AND_BACK, identifying multiple buffers, each selected buffer is cleared to the same value. Clamping and conversion for fixed-point color buffers are performed in the same fashion as glClearColor.
If buffer is GL_DEPTH, drawBuffer must be zero, and value points to a single value to clear the depth buffer to. Only glClearBufferfv should be used to clear depth buffers. Clamping and conversion for fixed-point depth buffers are performed in the same fashion as glClearDepth.
If buffer is GL_STENCIL, drawBuffer must be zero, and value points to a single value to clear the stencil buffer to. Only glClearBufferiv should be used to clear stencil buffers. Masking and type conversion are performed in the same fashion as glClearStencil.
glClearBufferfi may be used to clear the depth and stencil buffers. buffer must be GL_DEPTH_STENCIL and drawBuffer must be zero. depth and stencil are the depth and stencil values, respectively.
The result of glClearBuffer is undefined if no conversion between the type of value and the buffer being cleared is defined. However, this is not an error.
The pixel ownership test, the scissor test, dithering, and the buffer writemasks affect the operation of glClearBuffer. The scissor box, if enabled, bounds the cleared region.
Errors
GL_INVALID_ENUM is generated by glClearBufferif, glClearBufferfv and glClearBufferuiv if buffer is not GL_COLOR, GL_FRONT, GL_BACK, GL_LEFT, GL_RIGHT, GL_FRONT_AND_BACK, GL_DEPTH or GL_STENCIL.
GL_INVALID_ENUM is generated by glClearBufferfi if buffer is not GL_DEPTH_STENCIL.
GL_INVALID_VALUE is generated if buffer is GL_COLOR, GL_FRONT, GL_BACK, GL_LEFT, GL_RIGHT, or GL_FRONT_AND_BACK and drawBuffer is greater than or equal to GL_MAX_DRAW_BUFFERS.
GL_INVALID_VALUE is generated if buffer is GL_DEPTH, GL_STENCIL or GL_DEPTH_STENCIL and drawBuffer is not zero.
See Also
glClearColor, glClearDepth, glClearStencil, glClear, glColorMask, glDepthMask, glDrawBuffers, glScissor, glStencilMask
Copyright
Copyright © 2010 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.