glClearBufferSubData.3G man page

glClearBufferSubData, glClearNamedBufferSubData — fill all or part of buffer object's data store with a fixed value

C Specification

void glClearBufferSubData(GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void * data);

void glClearNamedBufferSubData(GLuint buffer, GLenum internalformat, GLintptr offset, GLsizei size, GLenum format, GLenum type, const void *data);

Parameters

target

Specifies the target to which the buffer object is bound for glClearBufferSubData, which must be one of the buffer binding targets in the following table:

Buffer Binding TargetPurpose
GL_ARRAY_BUFFERVertex attributes
GL_ATOMIC_COUNTER_BUFFERAtomic counter storage
GL_COPY_READ_BUFFERBuffer copy source
GL_COPY_WRITE_BUFFERBuffer copy destination
GL_DISPATCH_INDIRECT_BUFFERIndirect compute dispatch commands
GL_DRAW_INDIRECT_BUFFERIndirect command arguments
GL_ELEMENT_ARRAY_BUFFERVertex array indices
GL_PIXEL_PACK_BUFFERPixel read target
GL_PIXEL_UNPACK_BUFFERTexture data source
GL_QUERY_BUFFERQuery result buffer
GL_SHADER_STORAGE_BUFFERRead-write storage for shaders
GL_TEXTURE_BUFFERTexture data buffer
GL_TRANSFORM_FEEDBACK_BUFFERTransform feedback buffer
GL_UNIFORM_BUFFERUniform block storage

buffer

Specifies the name of the buffer object for glClearNamedBufferSubData.

internalformat

The internal format with which the data will be stored in the buffer object.

offset

The offset in basic machine units into the buffer object's data store at which to start filling.

size

The size in basic machine units of the range of the data store to fill.

format

The format of the data in memory addressed by data.

type

The type of the data in memory addressed by data.

data

The address of a memory location storing the data to be replicated into the buffer's data store.

Description

glClearBufferSubData and glClearNamedBufferSubData fill a specified region of a buffer object's data store with data from client memory.

offset and size specify the extent of the region within the data store of the buffer object to fill with data. Data, initially supplied in a format specified by format in data type type is read from the memory address given by data and converted into the internal representation given by internalformat, which must be one of the following sized internal formats:

Component
Sized Internal FormatBase TypeComponentsNorm0123
GL_R8ubyte1YESR001
GL_R16ushort1YESR001
GL_R16Fhalf1NOR001
GL_R32Ffloat1NOR001
GL_R8Ibyte1NOR001
GL_R16Ishort1NOR001
GL_R32Iint1NOR001
GL_R8UIubyte1NOR001
GL_R16UIushort1NOR001
GL_R32UIuint1NOR001
GL_RG8ubyte2YESRG01
GL_RG16ushort2YESRG01
GL_RG16Fhalf2NORG01
GL_RG32Ffloat2NORG01
GL_RG8Ibyte2NORG01
GL_RG16Ishort2NORG01
GL_RG32Iint2NORG01
GL_RG8UIubyte2NORG01
GL_RG16UIushort2NORG01
GL_RG32UIuint2NORG01
GL_RGB32Ffloat3NORGB1
GL_RGB32Iint3NORGB1
GL_RGB32UIuint3NORGB1
GL_RGBA8uint4YESRGBA
GL_RGBA16short4YESRGBA
GL_RGBA16Fhalf4NORGBA
GL_RGBA32Ffloat4NORGBA
GL_RGBA8Ibyte4NORGBA
GL_RGBA16Ishort4NORGBA
GL_RGBA32Iint4NORGBA
GL_RGBA8UIubyte4NORGBA
GL_RGBA16UIushort4NORGBA
GL_RGBA32UIuint4NORGBA

This converted data is then replicated throughout the specified region of the buffer object's data store. If data is NULL, then the subrange of the buffer's data store is filled with zeros.

Errors

GL_INVALID_ENUM is generated by glClearBufferSubData if target is not one of the generic buffer binding targets.

GL_INVALID_VALUE is generated by glClearBufferSubData if no buffer is bound to target.

GL_INVALID_OPERATION is generated by glClearNamedBufferSubData if buffer is not the name of an existing buffer object.

GL_INVALID_ENUM is generated if internalformat is not one of the valid sized internal formats listed in the table above.

GL_INVALID_VALUE is generated if offset or range are not multiples of the number of basic machine units per-element for the internal format specified by internalformat. This value may be computed by multiplying the number of components for internalformat from the table by the size of the base type from the table.

GL_INVALID_VALUE is generated if offset or size is negative, or if $offset + size$ is greater than the value of GL_BUFFER_SIZE for the buffer object.

GL_INVALID_OPERATION is generated if any part of the specified range of the buffer object is mapped with glMapBufferRange() or glMapBuffer(), unless it was mapped with the GL_MAP_PERSISTENT_BIT bit set in the glMapBufferRange access flags.

GL_INVALID_VALUE is generated if format is not a valid format, or type is not a valid type.

Version Support

OpenGL Version
Function / Feature Name2.02.13.03.13.23.34.04.14.24.34.44.5
glClearBufferSubData---------
glClearNamedBufferSubData-----------

See Also

glClearBufferData().

Referenced By

glClearNamedBufferSubData.3G(3) is an alias of glClearBufferSubData.3G(3).

12/28/2016 [FIXME: source] [FIXME: manual]