GLAPI/glBindVertexBuffers

From OpenGL.org
Jump to: navigation, search
glBindVertexBuffers
Core in version 4.4

glBindVertexBuffers: bind one or more named buffer objects to a sequence of consecutive vertex buffer binding points

Function Definition

 void glBindVertexBuffers(GLuint first​, GLsizei count​, const GLuint *buffers​, const GLuintptr *offsets​, const GLsizei *strides​);
first
Specifies the first vertex buffer binding point to which a buffer object is to be bound.
count
Specifies the number of buffers to bind.
buffers
Specifies the address of an array of names of existing buffer objects.
offsets
Specifies the address of an array of offsets to associate with the binding points.
buffers
Specifies the address of an array of strides to associate with the binding points.

Description

glBindVertexBuffers binds storage from an array of existing buffer objects to a specified number of consecutive vertex buffer binding points units. count​ specifies the number of buffer objects whose names are stored in the array buffers​. That number of buffer object names is read from the array and their storage bound to the count​ consecutive vertex buffer binding points starting from first​.

If the name zero appears in the buffers​ array, any existing binding to the vertex buffer binding point is reset, and the corresponding entries in offsets​ and strides​ is ignored. Any non-zero entry in buffers​ must be the name of an existing buffer object. When a non-zero entry in buffers​ is present, that buffer objects data store is bound to the corresponding vertex buffer binding point. If buffers​ is NULL​ then it is as if an appropriately sized array containing only zeros had been specified.

offsets​ and strides​ specify the addresses of two arrays containing, respectively, the offset of the first element and stride between elements in each buffer. If an entry in buffers​ is zero, then the content of the corresponding entry in each of offsets​ and strides​ is ignored.

glBindVertexBuffers is equivalent to the following pseudo code:


    for (i = 0; i < count; i++) {
        if (buffers == NULL) {
            glBindVertexBuffer(first + i, 0, 0, 16);
        } else {
            glBindVertexBuffer(first + i, buffers[i], offsets[i], strides[i]);
        }
    }

Each entry in buffers​ will be checked individually and if found to be invalid, the state for that vertex buffer binding point will not be changed and an error will be generated. However, the state for other binding points referenced by the command will still be updated.

Notes

glBindVertexBuffers is available only if the GL version is 4.4 or higher.

Errors

GL_INVALID_OPERATION​ is generated if first​ + count​ is greater than the value of GL_MAX_VERTEX_ATTRIB_BINDINGS​.

GL_INVALID_OPERATION​ is generated if any value in buffers​ is not zero or the name of an existing buffer object.

GL_INVALID_VALUE​ is generated if any value in offsets​ or strides​ is negative, or if a value is stride​ is greater than the value of GL_MAX_VERTEX_ATTRIB_STRIDE​.

See Also

glGenBuffers, glBindBuffer, glDeleteBuffersglDeleteTextures

Copyright

Copyright © 2013 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/.