GLBUFFERDATA(3gl)GLBUFFERDATA(3gl)NAME
glBufferData - initialize the data store of a buffer object
C SPECIFICATION
void glBufferData( GLenum target,
GLsizeiptr size,
const GLvoid * data,
GLenum usage )
PARAMETERS
target Specifies the target buffer. Must be GL_ARRAY_BUFFER or GL_ELE‐
MENT_ARRAY_BUFFER.
size Specifies the size of the buffer store.
data Specifies a pointer to the source data in client memory.
usage Specifies the expected application usage pattern of the data
store. The following symbolic values are accepted:
GL_STREAM_DRAW, GL_STREAM_READ, GL_STREAM_COPY, GL_STATIC_DRAW,
GL_STATIC_READ, GL_STATIC_COPY, GL_DYNAMIC_DRAW,
GL_DYNAMIC_READ, GL_DYNAMIC_COPY.
DESCRIPTION
glBufferData deletes any existing data store, and sets the values of
the buffer object's state variables GL_BUFFER_SIZE to size, GL_BUF‐
FER_USAGE to usage, GL_BUFFER_ACCESS to GL_READ_WRITE, GL_BUFFER_MAPPED
to GL_FALSE, and GL_BUFFER_MAP_POINTER to NULL.
If data is not NULL, then the source data is copied to the buffer
object's data store. If data is NULL, then contents of the buffer
object's data store are undefined.
The usage pattern can assume one of nine symbolic values:
GL_STREAM_DRAW
The data store contents will be specified once by the appli‐
cation, and used at most a few times as the source of a GL
drawing command.
GL_STREAM_READ
The data store contents will be specified once by reading
data from the GL, and queried at most a few times by the
application.
GL_STREAM_COPY
The data store contents will be specified once by reading
data from the GL, and used at most a few times as the source
of a GL drawing command.
GL_STATIC_DRAW
The data store contents will be specified once by the appli‐
cation, and used many times as the source of a GL drawing
command.
GL_STATIC_READ
The data store contents will be specified once by reading
data from the GL, and queried many times by the application.
GL_STATIC_COPY
The data store contents will be specified once by reading
data from the GL, and used many times as the source of a GL
drawing command.
GL_DYNAMIC_DRAW
The data store contents will be specified repeatedly by the
application, and used many times as the source of a GL draw‐
ing command.
GL_DYNAMIC_READ
The data store contents will be specified repeatedly by read‐
ing data from the GL, and queried many times by the applica‐
tion.
GL_DYNAMIC_COPY
The data store contents will be specified repeatedly by read‐
ing data from the GL, and used many times as the source of a
GL drawing command.
NOTES
The usage value is provided as a performance hint only. The specified
usage value does not contstrain the actual usage pattern of the data
store.
ERRORS
GL_INVALID_ENUM is generated if target is not GL_ARRAY_BUFFER, or
GL_ELEMENT_ARRAY_BUFFER.
GL_INVALID_ENUM is generated if usage is not an accepted usage symbolic
constant.
GL_INVALID_VALUE is generated if size is less than 0.
GL_OUT_OF_MEMORY is generated if it is unable to create a data store of
the requested size.
ASSOCIATED GETS
glGetBufferParameter with argument GL_BUFFER_SIZE
glGetBufferParameter with argument GL_BUFFER_USAGE
glGetBufferParameter with argument GL_BUFFER_ACCESS
glGetBufferParameter with argument GL_BUFFER_MAPPED
glGetBufferPointer with argument GL_BUFFER_MAP_POINTER
SEE ALSO
glBufferSubData, glGetBufferParameter.
13 Jan 04 GLBUFFERDATA(3gl)