glBufferStorage
glBufferStorage is an OpenGL function that creates immutable storage for a buffer object bound to a specified target. Introduced with the ARB_buffer_storage extension and core in OpenGL 4.4, it allocates a data store of the given size for the bound buffer object. The storage cannot be resized via glBufferData, making it immutable; however, the contents can be updated with glBufferSubData or by mapping, provided the appropriate access is permitted by the specified flags. If data is non-null, the initial contents are copied into the buffer; otherwise the storage is uninitialized or zero-initialized depending on implementation.
The function signature is void glBufferStorage(GLenum target, GLsizeiptr size, const void * data, GLbitfield flags). The target
- GL_MAP_READ_BIT and GL_MAP_WRITE_BIT to allow mapped access by the client.
- GL_DYNAMIC_STORAGE_BIT to indicate the storage will be updated frequently.
- GL_MAP_PERSISTENT_BIT and GL_MAP_COHERENT_BIT to enable persistent and coherent mapping, enabling the client to keep maps across
- GL_CLIENT_STORAGE_BIT (where supported) to request client-provided storage.
Usage typically involves binding the buffer, calling glBufferStorage with the desired size and flags, and optionally