glBindBuffer Function

Syntax

GL_APICALL void GL_APIENTRY glBindBuffer(
     GLenum target,
     GLuint buffer
);

Parameters

Name Description
in target Bind target
in buffer Vertex buffer object.

Return Values

No values are returned.

Description

Binds a vertex buffer object to the current bind target.

Set target to the following values.

GL_ARRAY_BUFFERVertex buffer
GL_ELEMENT_ARRAY_BUFFERIndex buffer
GL_VERTEX_STATE_COLLECTION_DMPVertex state collection

Set buffer to a vertex buffer object generated by the glGenBuffers function. If you specify a nonexistent vertex buffer object, a new vertex buffer object of that name is created simultaneously.

A value of GL_VERTEX_STATE_COLLECTION_DMP indicates a vertex state collection; this feature is used to pack settings for vertex buffers and vertex attributes. Once you bind an object to GL_VERTEX_STATE_COLLECTION_DMP, function settings are associated with that object during future calls to glBindBuffer, glVertexAttribPointer, glEnableVertexAttribArray, glDisableVertexAttribArray, and glVertexAttrib{1234}{fv}. By binding a vertex state collection object, you can restore these associated settings all at once.

This function generates the following errors.

GL_OUT_OF_MEMORYFailed to allocate the management region.
GL_INVALID_ENUMThe target argument was set to an invalid value.
GL_INVALID_OPERATIONAlready bound to a bind target of a different type.

A vertex state collection has a different object type than other bind targets. Once this function is called, the object type of buffer is fixed; it can no longer be bound to another type of bind target. A GL_INVALID_OPERATION error occurs when you bind an object to a bind target of a different type. Because GL_ARRAY_BUFFER and GL_ELEMENT_ARRAY_BUFFER are handled as the same type of bind target, you can bind to one of these targets and then later bind to the other.

Revision History

2010/01/07
Initial version.

CONFIDENTIAL