Difference between revisions of "GLAPI/glBindBuffersRange"

From OpenGL Wiki
Jump to navigation Jump to search
(→‎Function Definition: Missing parameters.)
Line 63: Line 63:
== See Also ==
== See Also ==
{{apifunc|glGenBuffers}}, {{apifunc|glDeleteBuffers}}, {{apifunc|glBindBuffer}}, {{apifunc|glBindBufferBase}}, {{apifunc|glBindBufferRange}}, {{apifunc|glBindBuffersRange}}, {{apifunc|glMapBuffer}}, {{apifunc|glUnmapBuffer}}
{{apifunc|glBindBuffersBase}}, {{apifunc|glGenBuffers}}, {{apifunc|glDeleteBuffers}}, {{apifunc|glBindBuffer}}, {{apifunc|glBindBufferBase}}, {{apifunc|glBindBufferRange}}, {{apifunc|glMapBuffer}}, {{apifunc|glUnmapBuffer}}
* [[Buffer Object]]
* [[Buffer Object]]

Latest revision as of 08:23, 1 August 2013

Core in version 4.6
Core since version 4.4
Core ARB extension ARB_multi_bind

glBindBuffersRange: bind ranges of one or more buffer objects to a sequence of indexed buffer targets

Function Definition

 void glBindBuffersRange(GLenum target​, GLuint first​, GLsizei count​, const GLuint *buffers​, const GLintptr *offsets​, const GLintptr *sizes​);
Specifies the target buffer object. The symbolic constant must be GL_ATOMIC_COUNTER_BUFFER, GL_TRANSFORM_FEEDBACK_BUFFER, GL_UNIFORM_BUFFER or GL_SHADER_STORAGE_BUFFER.
Specify the index of the first binding point within the array specified by target​.
Specify the number of contiguous binding points to which to bind buffers.
A pointer to an array of names of buffer objects to bind to the targets on the specified binding point, or NULL.
An array of offsets to the beginning of the range for each buffer, or NULL.
An array of sizes for the size of the range for each buffer, or NULL.


glBindBuffersRange binds a set of count​ ranges from buffer objects whose names are given in the array buffers​ to the count​ consecutive binding points starting from index index​ of the array of targets specified by target​. offsets​ specifies the address of an array containing count​ starting offsets within the buffers, and sizes​ specifies the adderess of an array of count​ sizes of the ranges. If buffers​ is NULL then offsets​ and sizes​ are ignored and glBindBuffersRange unbinds any buffers that are currently bound to the referenced binding points.

Assuming no errors are generated, it is equivalent to the following pseudo-code (with the exceptions noted below), which calls glBindBufferRange:

    for (i = 0; i < count; i++)
        if (buffers != NULL)
            glBindBufferRange(target, first + i, buffers[i], offsets[i], sizes[i]);
            glBindBufferBase(target, first + i, 0);

The exceptions are that the single general buffer binding corresponding to target​ is unmodified, and that buffers will not be created if they do not exist.


Note that because glBindBuffersRange cannot create new buffer objects (even if a name passed has been previously generated by call to glGenBuffers), names pased to glBindBuffersRange must have been bound at least once previously via a call to glBindBuffer.



GL_INVALID_OPERATION is generated if first​ + count​ is greater than the number of target-specific indexed binding points.

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 by if any value in offsets​ is less than zero or if any value in sizes​ is less than zero.

GL_INVALID_VALUE is generated if any pair of values in offsets​ and sizes​ does not respectively satisfy the constraints described for those parameters for the specified target.

See Also

glBindBuffersBase, glGenBuffers, glDeleteBuffers, glBindBuffer, glBindBufferBase, glBindBufferRange, glMapBuffer, glUnmapBuffer


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/.