Graphics Reference
In-Depth Information
buffer object is used to store vertex attribute data for vertices of one or
more primitives. The element array buffer object stores the indices of one
or more primitives. The actual array or element data are specified using
glBufferData
. Note that
GL_STATIC_DRAW
is passed as an argument to
glBufferData
. This value is used to describe how the buffer is accessed by
the application and will be described later in this section.
void
glGenBuffers
(GLsizei
n
, GLuint *
buffers
)
n
number of buffer object names to return
buffers
pointer to an array of
n
entries, where allocated buffer
objects are returned
glGenBuffers
assigns
n
buffer object names and returns them in
buffers
. The buffer object names returned by
glGenBuffers
are
unsigned integer numbers other than
0
. The value
0
is reserved by
OpenGL ES and does not refer to a buffer object. Attempts to modify or
query the buffer object state for buffer object
0
will generate an error.
The
glBindBuffer
command is used to make a buffer object current. The
first time a buffer object name is bound by calling
glBindBuffer
,
the buffer object is allocated with the default state; if the allocation is
successful, this allocated object is bound as the current buffer object for
the target.
void
glBindBuffer
(GLenum
target
, GLuint
buffer
)
target
can be set to any of the following targets:
GL_ARRAY_BUFFER
GL_ELEMENT_ARRAY_BUFFER
GL_COPY_READ_BUFFER
GL_COPY_WRITE_BUFFER
GL_PIXEL_PACK_BUFFER
GL_PIXEL_UNPACK_BUFFER
GL_TRANSFORM_FEEDBACK_BUFFER
GL_UNIFORM_BUFFER
buffer
buffer object to be assigned as the current object to target