table of contents
GLBUFFERDATA(3G) | OpenGL Manual | GLBUFFERDATA(3G) |
NAME¶
glBufferData - creates and initializes a buffer object's data store
C SPECIFICATION¶
void glBufferData(GLenum target, GLsizeiptr size, const GLvoid * data, GLenum usage);
PARAMETERS¶
target
size
data
usage
DESCRIPTION¶
glBufferData creates a new data store for the buffer object currently bound to target. Any pre-existing data store is deleted. The new data store is created with the specified size in bytes and usage. If data is not NULL, the data store is initialized with data from this pointer. In its initial state, the new data store is not mapped, it has a NULL mapped pointer, and its mapped access is GL_READ_WRITE.
usage is a hint to the GL implementation as to how a buffer object's data store will be accessed. This enables the GL implementation to make more intelligent decisions that may significantly impact buffer object performance. It does not, however, constrain the actual usage of the data store. usage can be broken down into two parts: first, the frequency of access (modification and usage), and second, the nature of that access. The frequency of access may be one of these:
STREAM
STATIC
DYNAMIC
The nature of access may be one of these:
DRAW
READ
COPY
NOTES¶
If data is NULL, a data store of the specified size is still created, but its contents remain uninitialized and thus undefined.
Clients must align data elements consistent with the requirements of the client platform, with an additional base-level requirement that an offset within a buffer to a datum comprising N bytes be a multiple of N.
The GL_ATOMIC_COUNTER_BUFFER target is available only if the GL version is 4.2 or greater.
The GL_DISPATCH_INDIRECT_BUFFER and GL_SHADER_STORAGE_BUFFER targets are available only if the GL version is 4.3 or greater.
ERRORS¶
GL_INVALID_ENUM is generated if target is not one of the accepted buffer targets.
GL_INVALID_ENUM is generated if usage is not GL_STREAM_DRAW, GL_STREAM_READ, GL_STREAM_COPY, GL_STATIC_DRAW, GL_STATIC_READ, GL_STATIC_COPY, GL_DYNAMIC_DRAW, GL_DYNAMIC_READ, or GL_DYNAMIC_COPY.
GL_INVALID_VALUE is generated if size is negative.
GL_INVALID_OPERATION is generated 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 specified size.
ASSOCIATED GETS¶
glGetBufferSubData()
glGetBufferParameter() with argument GL_BUFFER_SIZE or GL_BUFFER_USAGE
SEE ALSO¶
glBindBuffer(), glBufferSubData(), glMapBuffer(), glUnmapBuffer()
COPYRIGHT¶
Copyright © 2005 Addison-Wesley. Copyright © 2011-2012 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/.
AUTHORS¶
opengl.org
05/02/2014 | opengl.org |