GLBINDBUFFERSRANGE(3G)
π GLBINDBUFFERSRANGE (3G) β ok bestie, let's talk buffer ranges
Hiii so this is glBindBuffersRange, straight out of the 3G manual section, and honestly? It's giving "do a lot of binding with one call" energy. Sit down, grab a strawberry π, and let's get into it.
β¨ NAME β¨
glBindBuffersRange β bind ranges of one or more buffer objects to a sequence of indexed buffer targets π
πΈ C SPECIFICATION πΈ
void glBindBuffersRange(GLenum target, GLuint first, GLsizei count,
const GLuint *buffers, const GLintptr *offsets,
const GLintptr *sizes);
π¦ PARAMETERS π¦
targetβ the target of the bind operation, bestie.targetmust be one ofGL_ATOMIC_COUNTER_BUFFER,GL_TRANSFORM_FEEDBACK_BUFFER,GL_UNIFORM_BUFFERorGL_SHADER_STORAGE_BUFFER. That's the whole list, no extras, don't try it πfirstβ the index of the first binding point within the array specified bytarget.countβ how many contiguous binding points you're binding buffers to.buffersβ a pointer to an array of names of buffer objects to bind to the targets on the specified binding point, orNULL. Yes,NULLis allowed, and yes, that's a whole mood.offsetsβ a pointer to an array of offsets into the corresponding buffer inbuffersto bind, orNULLifbuffersisNULL.sizesβ a pointer to an array of sizes of the corresponding buffer inbuffersto bind, orNULLifbuffersisNULL.
π DESCRIPTION π
Okay so here's the tea β: 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 first 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 address of an array of count sizes of the ranges.
Now β iconic behavior alert π¨ β if buffers is NULL then offsets and sizes are ignored and glBindBuffersRange unbinds any buffers that are currently bound to the referenced binding points. Poof, gone, unbound. π«Ά
Assuming no errors are generated, it is equivalent to the following pseudo-code, which calls glBindBufferRange(), with the exception that the non-indexed target is not changed by glBindBuffersRange:
for (i = 0; i < count; i++) {
if (buffers != NULL) {
glBindBufferRange(target, first + i, buffers[i], offsets[i], sizes[i]);
} else {
glBindBufferRange(target, first + i, 0);
}
}
And here's the part that's lowkey important, so pay attention bestie π β each entry in buffers, offsets, and sizes will be checked individually, and if found to be invalid, the state for that buffer binding index will not be changed and an error will be generated. However, the state for other buffer binding indices referenced by the command will still be updated. So it's not all-or-nothing, it's very "we move" about it. β¨
π NOTES π
glBindBuffersBase is available only if the GL version is 4.4 or higher.
(Yes, it says glBindBuffersBase on this page. That's what the page says. I'm just the messenger, don't come for me π)
π₯ ERRORS π₯
GL_INVALID_ENUMis generated iftargetis notGL_ATOMIC_COUNTER_BUFFER,GL_TRANSFORM_FEEDBACK_BUFFER,GL_UNIFORM_BUFFERorGL_SHADER_STORAGE_BUFFER.GL_INVALID_OPERATIONis generated iffirst + countis greater than the number of target-specific indexed binding points.GL_INVALID_OPERATIONis generated if any value inbuffersis not zero or the name of an existing buffer object.GL_INVALID_VALUEis generated by if any value inoffsetsis less than zero or if any value insizesis less than zero.GL_INVALID_VALUEis generated if any pair of values inoffsetsandsizesdoes not respectively satisfy the constraints described for those parameters for the specified target.
Okay the "generated by if" up there in the fourth bullet? That's literally how the page words it. Character for character. Not my typo, I would never π
π VERSION SUPPORT π
Here's the vibe check across the OpenGL versions, function name glBindBuffersRange:
2.0β-2.1β-3.0β-3.1β-3.2β-3.3β-4.0β-4.1β-4.2β-4.3β-4.4ββ4.5ββ
So it's a 4.4-and-up girlie. She did not exist before that and she's not pretending otherwise. π
π§ SEE ALSO π§
glGenBuffers(), glDeleteBuffers(), glBindBuffer(), glBindBufferBase(), glBindBufferRange(), glBindBuffersRange(), glMapBuffer(), glUnmapBuffer()
(Yes, glBindBuffersRange() is in its own SEE ALSO list. Self-love, honestly. Obsessed. π)
β COPYRIGHT β
Copyright Β© 2013-2014 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/.
Copyright Β© 2013-2014 Khronos Group
And that's the whole page, bestie π«Ά this came from [FIXME: source] and it's dated 08/09/2021 β so if anything's stale, blame the timeline, not me. Slay, stay bound, and don't forget to check your first + count π
π¦ where this page comes from
- centos-stream 9: gl-manpages 1.1-24.20190306.el9 Β· MIT and Open Publication
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms