GLDRAWRANGEELEMENTSB(3G)
π GLDRAWRANGEELEMENTSB(3G)
okay so first things first: this page lives in the 3G manual section (yes, that's the OpenGL one, hi bestie π«Ά), and its whole name is glDrawRangeElementsBaseVertex. It's a function, it draws stuff, and it has opinions about which indices you're allowed to feed it. Let's get into it β¨
π NAME
glDrawRangeElementsBaseVertex β render primitives from array data with a per-element offset. That's the whole vibe: draw things, but shift every index by a constant. Iconic, lowkey.
πΈ C SPECIFICATION
void glDrawRangeElementsBaseVertex(GLenum mode, GLuint start,
GLuint end, GLsizei count,
GLenum type, GLvoid *indices,
GLint basevertex);
That's the signature, character for character, no cap. Don't touch it, just admire it π¦
π PARAMETERS
modeβ tells the GPU what kind of primitives to render. Accepted values areGL_POINTS,GL_LINE_STRIP,GL_LINE_LOOP,GL_LINES,GL_TRIANGLE_STRIP,GL_TRIANGLE_FAN,GL_TRIANGLES,GL_LINES_ADJACENCY,GL_LINE_STRIP_ADJACENCY,GL_TRIANGLES_ADJACENCY,GL_TRIANGLE_STRIP_ADJACENCYandGL_PATCHES. That's the whole list, bestie, no substitutions πstartβ the minimum array index contained inindices. Your floor, basically.endβ the maximum array index contained inindices. Your ceiling.countβ how many elements are gonna be rendered. Like, the actual number, pls don't lie to it.typeβ the type of the values sitting insideindices. Must be one ofGL_UNSIGNED_BYTE,GL_UNSIGNED_SHORT, orGL_UNSIGNED_INT. Those three. That's it πindicesβ a pointer to the location where the indices are stored. Point at them. Politely.basevertexβ a constant that gets added to each element ofindiceswhen choosing elements from the enabled vertex arrays. It's the little offset that could π§
β¨ DESCRIPTION
So glDrawRangeElementsBaseVertex is like a restricted form of glDrawElementsBaseVertex(). Think of it as the same girl but with a curfew.
mode, count and basevertex match the corresponding arguments to glDrawElementsBaseVertex(), with one extra constraint: all values in the array indices must lie between start and end, inclusive β and that's prior to adding basevertex, okurrr? Index values that lie outside the range [start, end] are treated in the same way as glDrawElementsBaseVertex() does it.
The *i*th element transferred by the corresponding draw call will be taken from element indices[i] + basevertex of each enabled array. Math time π
If the resulting value is larger than the maximum value representable by type, it's as if the calculation were upconverted to 32-bit unsigned integers β with wrapping on overflow conditions. And heads up: the operation is undefined if the sum would be negative. Not undefined cute, undefined undefined. π¨
π₯ ERRORS
GL_INVALID_ENUMis generated ifmodeis not an accepted value. (Check the list above, bestie, it's literally right there.)GL_INVALID_VALUEis generated ifcountis negative. Negative counts? Not on this GPU's watch.GL_INVALID_VALUEis generated ifend < start. Your ceiling can't be lower than your floor, babe.GL_INVALID_OPERATIONis generated if a geometry shader is active andmodeis incompatible with the input primitive type of the geometry shader in the currently installed program object.GL_INVALID_OPERATIONis generated if a non-zero buffer object name is bound to an enabled array or the element array and the buffer object's data store is currently mapped.
π the mapped-buffer one gets people constantly. like, unmap it first, diva.
π VERSION SUPPORT
Here's the vibe check on which OpenGL versions show up for glDrawRangeElementsBaseVertex:
- OpenGL 2.0 β
-not supported π - OpenGL 2.1 β
-not supported π - OpenGL 3.0 β
-not supported π - OpenGL 3.1 β
-not supported π - OpenGL 3.2 β β supported π
- OpenGL 3.3 β β supported π
- OpenGL 4.0 β β supported π
- OpenGL 4.1 β β supported π
- OpenGL 4.2 β β supported π
- OpenGL 4.3 β β supported π
- OpenGL 4.4 β β supported π
- OpenGL 4.5 β β supported π
so basically if you're on anything before 3.2, this function is not the moment. 3.2 onwards? she ate. π₯
π¦ SEE ALSO
the whole friend group, fr fr:
glDrawElements()glDrawElementsBaseVertex()glDrawRangeElements()glDrawElementsInstanced()glDrawElementsInstancedBaseVertex()
π COPYRIGHT
Copyright Β© 2010-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 Β© 2010-2014 Khronos Group
okay that's the whole page, mwah π one last thing though β the source is listed as [FIXME: source], dated 08/09/2021, and the header/footer both read GLDRAWRANGEELEMENTSB(3G). so like, the docs themselves are a little unfinished, but honestly? relatable. go draw something gorgeous, bestie πΈβ¨π
π¦ 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