GLMULTIDRAWELEMENTS(3G)
π NAME π
ok so glMultiDrawElements β it renders multiple sets of primitives by, like, specifying indices of array data elements β¨ bestie this is the one that saves you a million function calls π«Ά
this one lives in the 3G manual section, and it's giving main character OpenGL energy ngl π
πΈ C SPECIFICATION πΈ
void glMultiDrawElements(GLenum mode, const GLsizei * count,
GLenum type, const GLvoid * const * indices,
GLsizei drawcount);
copy it exactly, okay? every pointer and const matters π
π PARAMETERS π
modeβ tells GL what kind of primitives to render. accepted values areGL_POINTS,GL_LINE_STRIP,GL_LINE_LOOP,GL_LINES,GL_LINE_STRIP_ADJACENCY,GL_LINES_ADJACENCY,GL_TRIANGLE_STRIP,GL_TRIANGLE_FAN,GL_TRIANGLES,GL_TRIANGLE_STRIP_ADJACENCY,GL_TRIANGLES_ADJACENCYandGL_PATCHESβ¨ that's the whole guest list, no plus-ones.countβ points to an array of the elements counts. like, how many indices per batch, one entry per draw πtypeβ the type of the values inindices. has to be exactly one ofGL_UNSIGNED_BYTE,GL_UNSIGNED_SHORT, orGL_UNSIGNED_INT. pick wrong and it's not gonna slay πindicesβ a pointer to the location where the indices are stored ποΈdrawcountβ the size of thecountandindicesarrays. iykyk π
π¦ DESCRIPTION π¦
okay so glMultiDrawElements specifies multiple sets of geometric primitives with, like, very few subroutine calls. no cap π₯
instead of calling a GL function to pass every single individual vertex, normal, texture coordinate, edge flag, or color β which is exhausting, literally β you can prespecify separate arrays of vertices, normals, and so on, and then use them to construct a sequence of primitives with a single call to glMultiDrawElements. one call. ONE. we love efficiency π
β¨
glMultiDrawElements is identical in operation to glDrawElements() except that drawcount separate lists of elements are specified. that's it, that's the whole difference, periodt π―
vertex attributes that are modified by glMultiDrawElements have an unspecified value after glMultiDrawElements returns. yeah, unspecified β don't come for me, that's what the spec says π. attributes that aren't modified maintain their previous values though, so those ones are safe πΈ
π§ NOTES π§
GL_LINE_STRIP_ADJACENCY, GL_LINES_ADJACENCY, GL_TRIANGLE_STRIP_ADJACENCY and GL_TRIANGLES_ADJACENCY are available only if the GL version is 3.2 or greater β like, don't try it on your 2.1 build and then act surprised, bestie π
π ERRORS π
GL_INVALID_ENUMis generated ifmodeis not an accepted value π«GL_INVALID_VALUEis generated ifdrawcountis negative. negative draws are not a vibe, they're an error π€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 π«
fr fr check your errors, the group chat does not want to debug your blank screen at 3am π
π VERSION SUPPORT π
like the table said, but make it a list because we're cute like that π
- Function / Feature Name:
glMultiDrawElements - OpenGL Version support:
βin2.0,βin2.1,βin3.0,βin3.1,βin3.2,βin3.3,βin4.0,βin4.1,βin4.2,βin4.3,βin4.4,βin4.5
she ate and left zero crumbs β all twelve versions, every single checkmark π β¨
π SEE ALSO π
glDrawArrays()glDrawRangeElements()
go read those too, they're the supporting cast and they're iconic in their own right π«Ά
π COPYRIGHT π
Copyright Β© 1991-2006 Silicon Graphics, Inc. Copyright Β© 2010-2014 Khronos Group. This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/. π
Copyright Β© 2010-2014 Khronos Group
and that's the whole page, bestie π source is [FIXME: source], dated 08/09/2021, and it's the GLMULTIDRAWELEMENTS(3G) page β mwah, go draw some triangles ππ
β¨
π¦ 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