GLDRAWELEMENTSINSTAN(3G)
π GLDRAWELEMENTSINSTAN(3G)
okay so bestie, welcome to the 3G manual page, and buckle up because this function name is a whole mouthful π β say it with me: glDrawElementsInstancedBaseVertexBaseInstance. Iconic. Unhinged. Ate. Periodt.
β¨ NAME β¨
glDrawElementsInstancedBaseVertexBaseInstance β render multiple instances of a set of primitives from array data with a per-element offset π«Ά
π C SPECIFICATION π
void glDrawElementsInstancedBaseVertexBaseInstance(GLenum mode,
GLsizei count,
GLenum type,
GLvoid *indices,
GLsizei primcount,
GLint basevertex,
GLuint baseinstance);
πΈ PARAMETERS πΈ
modeβ tells the GPU what kinda primitives we're serving today π. 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.countβ the number of elements to be rendered. literally how many we're drawing β¨typeβ the type of the values inindices. bestie it must be one ofGL_UNSIGNED_BYTE,GL_UNSIGNED_SHORT, orGL_UNSIGNED_INT. no substitutions, this is a vibe check and they all pass πindicesβ a pointer to the location where the indices are stored πprimcountβ the number of instances of the indexed geometry that should be drawn. yes, we're doing it multiple times, main character energy π₯basevertexβ a constant that should be added to each element ofindiceswhen choosing elements from the enabled vertex arrays. it's giving "offset but make it a whole personality" π¦baseinstanceβ the base instance for use in fetching instanced vertex attributes π
π DESCRIPTION π
So glDrawElementsInstancedBaseVertexBaseInstance behaves identically to glDrawElementsInstanced() β same energy, same job β except that the i-th element transferred by the corresponding draw call will be taken from element indices[i] + basevertex of each enabled array. Cute, right? π
Now, if the resulting value is larger than the maximum value representable by type, it is as if the calculation were upconverted to 32-bit unsigned integers (with wrapping on overflow conditions). β οΈ And the operation is undefined if the sum would be negative β like, actually undefined, don't do that, no cap π
Specific vertex attributes may be classified as instanced through the use of glVertexAttribDivisor(). Instanced vertex attributes supply per-instance vertex data to the vertex shader β¨ The index of the vertex fetched from the enabled instanced vertex attribute arrays is calculated as gl _ InstanceID divisor + baseInstance. Note that baseinstance does not affect the shader-visible value of gl_InstanceID π
π¦ NOTES π¦
glDrawElementsInstancedBaseVertex is only supported if the GL version is 3.2 or greater. that's the rule, bestie π«Ά
π ERRORS π
GL_INVALID_ENUMβ generated ifmodeis not an accepted value. wrong vibe, rejected πGL_INVALID_VALUEβ generated ifcountorprimcountis negative. negative?? not on my watch πGL_INVALID_OPERATIONβ generated if a geometry shader is active andmodeis incompatible with the input primitive type of the geometry shader in the currently installed program object. they're not matching and the GPU is not having it π₯GL_INVALID_OPERATIONβ 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. bestie it's mapped, put it back π
β VERSION SUPPORT β
Feature name: glDrawElementsInstancedBaseVertexBaseInstance β here's the whole glow-up timeline, no skips:
2.0β-(nope)2.1β-(nope)3.0β-(nope)3.1β-(nope)3.2β-(nope)3.3β-(nope)4.0β-(nope)4.1β-(nope)4.2ββ(hello π)4.3ββ4.4ββ4.5ββ
so yeah, 4.2 and up is where she lives π
π SEE ALSO π
glDrawElements(), glDrawRangeElements(), glDrawRangeElementsBaseVertex(), glDrawElementsInstanced(), glDrawElementsInstancedBaseVertex()
π COPYRIGHT π
Copyright Β© 2011-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 π
Copyright Β© 2011-2014 Khronos Group
okay that's the whole page bestie, you're officially educated π mwah π β this cutie was served up from [FIXME: source], dated 08/09/2021, and yes the page is still called GLDRAWELEMENTSINSTAN(3G) because we respect the name πβ¨
π¦ 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