table of contents
GLBUFFERSTORAGE(3G) | [FIXME: manual] | GLBUFFERSTORAGE(3G) |
NAME¶
glBufferStorage, glNamedBufferStorage - creates and initializes a buffer object's immutable data store
C SPECIFICATION¶
void glBufferStorage(GLenum target, GLsizeiptr size, const GLvoid * data, GLbitfield flags);
void glNamedBufferStorage(GLuint buffer, GLsizei size, const void *data, GLbitfield flags);
PARAMETERS¶
target
Buffer Binding Target | Purpose |
GL_ARRAY_BUFFER | Vertex attributes |
GL_ATOMIC_COUNTER_BUFFER | Atomic counter storage |
GL_COPY_READ_BUFFER | Buffer copy source |
GL_COPY_WRITE_BUFFER | Buffer copy destination |
GL_DISPATCH_INDIRECT_BUFFER | Indirect compute dispatch commands |
GL_DRAW_INDIRECT_BUFFER | Indirect command arguments |
GL_ELEMENT_ARRAY_BUFFER | Vertex array indices |
GL_PIXEL_PACK_BUFFER | Pixel read target |
GL_PIXEL_UNPACK_BUFFER | Texture data source |
GL_QUERY_BUFFER | Query result buffer |
GL_SHADER_STORAGE_BUFFER | Read-write storage for shaders |
GL_TEXTURE_BUFFER | Texture data buffer |
GL_TRANSFORM_FEEDBACK_BUFFER | Transform feedback buffer |
GL_UNIFORM_BUFFER | Uniform block storage |
buffer
size
data
flags
DESCRIPTION¶
glBufferStorage and glNamedBufferStorage create a new immutable data store. For glBufferStorage, the buffer object currently bound to target will be initialized. For glNamedBufferStorage, buffer is the name of the buffer object that will be configured. The size of the data store is specified by size. If an initial data is available, its address may be supplied in data. Otherwise, to create an uninitialized data store, data should be NULL.
The flags parameters specifies the intended usage of the buffer's data store. It must be a bitwise combination of a subset of the following flags:
GL_DYNAMIC_STORAGE_BIT
GL_MAP_READ_BIT
GL_MAP_WRITE_BIT
GL_MAP_PERSISTENT_BIT
GL_MAP_COHERENT_BIT
GL_CLIENT_STORAGE_BIT
The allowed combinations of flags are subject to certain restrictions. They are as follows:
NOTES¶
glBufferStorage is available only if the GL version is 4.4 or greater.
glNamedBufferStorage is available only if the GL version is 4.5 or greater.
If data is NULL, a data store of the specified size is still created, but its contents remain uninitialized and thus undefined.
ERRORS¶
GL_INVALID_ENUM is generated by glBufferStorage if target is not one of the accepted buffer targets.
GL_INVALID_OPERATION is generated by glNamedBufferStorage if buffer is not the name of an existing buffer object.
GL_INVALID_VALUE is generated if size is less than or equal to zero.
GL_INVALID_OPERATION is generated by glBufferStorage if the reserved buffer object name 0 is bound to target.
GL_OUT_OF_MEMORY is generated if the GL is unable to create a data store with the properties requested in flags.
GL_INVALID_VALUE is generated if flags has any bits set other than those defined above.
GL_INVALID_VALUE error is generated if flags contains GL_MAP_PERSISTENT_BIT but does not contain at least one of GL_MAP_READ_BIT or GL_MAP_WRITE_BIT.
GL_INVALID_VALUE is generated if flags contains GL_MAP_COHERENT_BIT, but does not also contain GL_MAP_PERSISTENT_BIT.
GL_INVALID_OPERATION is generated by glBufferStorage if the GL_BUFFER_IMMUTABLE_STORAGE flag of the buffer bound to target is GL_TRUE.
ASSOCIATED GETS¶
glGetBufferSubData()
glGetBufferParameter() with argument GL_BUFFER_SIZE or GL_BUFFER_USAGE
VERSION SUPPORT¶
OpenGL Version | ||||||||||||
Function / Feature Name | 2.0 | 2.1 | 3.0 | 3.1 | 3.2 | 3.3 | 4.0 | 4.1 | 4.2 | 4.3 | 4.4 | 4.5 |
glBufferStorage | - | - | - | - | - | - | - | - | - | - | ✔ | ✔ |
glNamedBufferStorage | - | - | - | - | - | - | - | - | - | - | - | ✔ |
SEE ALSO¶
glBindBuffer(), glBufferSubData(), glMapBuffer(), glUnmapBuffer()
COPYRIGHT¶
Copyright © 2014 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/.
COPYRIGHT¶
Copyright © 2014 Khronos Group
11/18/2024 | [FIXME: source] |