GLMULTIDRAWARRAYSIND(3G)
π
GLMULTIDRAWARRAYSIND(3G) β bestie, it's the 3G manual page
okay so picture this: you got a ton of primitives to draw, right? and you are NOT about to spam the driver with a million subroutine calls like some kind of NPC. this page is your girl. no cap, this is the one that lets the GPU fetch its own draw parameters straight out of memory, and it's giving main character energy β¨
πΈ NAME πΈ
glMultiDrawArraysIndirectCount β render multiple sets of primitives from array data, taking parameters and count from memory π
β¨ C SPECIFICATION β¨
void glMultiDrawArraysIndirectCount(GLenum mode, const void *indirect,
GLintptr drawcount,
GLsizei maxdrawcount,
GLsizei stride);
π PARAMETERS π
modeβ literally specifies what kind of primitives to render. the following symbolic constants are accepted, and yes you gotta pick one of these exact ones:GL_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_ADJACENCY, andGL_PATCHES. that's the whole roster π«Άindirectβ the address of an array of structures holding all the draw parameters. so like, the actual homework. πdrawcountβ an offset (in bytes, okurrr) into the buffer object bound to theGL_PARAMETER_BUFFERbinding point, where a singlesizeityped value lives. must be a multiple of four. don't come in here with your weird byte offsets πmaxdrawcountβ the maximum number of draws that are expected to be stored in the buffer. and here's the tea: if the value stored atdrawcountinto the buffer is greater thanmaxdrawcount, the implementation just stops processing draws aftermaxdrawcountparameter sets. it's a hard cutoff, bestie πstrideβ the distance in basic machine units between elements of the draw parameter array. basically the gap between your structs. π§
π₯ DESCRIPTION π₯
glMultiDrawArraysIndirectCount specifies multiple geometric primitives with very few subroutine calls. like, minimal effort, maximum slay. π
it behaves similarly to glMultiDrawArraysIndirect(), except that the drawcount parameter is stored in the buffer bound to the GL_PARAMETER_BUFFER binding at the offset specified by drawcount. so instead of you passing the count in by hand, it's chillin' in memory. iykyk π
the parameters addressed by indirect are packed into an array of structures, and each element takes this exact form (in C):
typedef struct {
uint count;
uint instanceCount;
uint first;
uint baseInstance;
} DrawArraysIndirectCommand;
so if a buffer is bound to the GL_DRAW_INDIRECT_BUFFER binding at the time of a call to glMultiDrawArraysIndirectCount, then indirect is interpreted as an offset, in basic machine units, into that buffer β and the parameter data is read from the buffer rather than from client memory. glow-up behavior honestly β¨
and here's a fun little contrast for you: unlike glDrawArraysInstancedBaseInstance(), the first member of the parameter structure is unsigned, and out-of-range indices do not generate an error. wild, i know. π€―
β οΈ real talk though: vertex attributes that are modified byglMultiDrawArraysIndirectCounthave an unspecified value afterglMultiDrawArraysIndirectCountreturns. attributes that aren't modified remain well defined. so don't go reading the modified ones and acting surprised. π
π ERRORS π
these are the ways to get yelled at. every single one, no skipping:
GL_INVALID_ENUMis generated ifmodeis not an accepted value. pick a real one bestie π₯²GL_INVALID_VALUEis generated ifstrideis not a multiple of four.GL_INVALID_VALUEis generated ifdrawcountis negative. no negative offsets, that's not the vibe.GL_INVALID_OPERATIONis generated if a non-zero buffer object name is bound to an enabled array or to theGL_DRAW_INDIRECT_BUFFERbinding and the buffer object's data store is currently mapped. unmapped = unmapped, periodt.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 ifmodeisGL_PATCHESand no tessellation control shader is active. patches need their shader, she's nothing without her πGL_INVALID_OPERATIONerror is generated if no buffer is bound to theGL_PARAMETER_BUFFERbinding point.GL_INVALID_OPERATIONerror is generated ifdrawcountis not a multiple of four.GL_INVALID_OPERATIONerror is generated if reading asizeityped value from the buffer bound to theGL_PARAMETER_BUFFERtarget at the offset specified bydrawcountwould result in an out-of-bounds access. π do not do that.
π VERSION SUPPORT π
okay so the original is a big glamorous table β rows are Function / Feature Name, columns are OpenGL Version β and the only entry is glMultiDrawArraysIndirectCount. here's the whole thing spelled out, every version, every symbol, so you don't miss a crumb π
- OpenGL
2.0β- - OpenGL
2.1β- - OpenGL
3.0β- - OpenGL
3.1β- - OpenGL
3.2β- - OpenGL
3.3β- - OpenGL
4.0β- - OpenGL
4.1β- - OpenGL
4.2β- - OpenGL
4.3β- - OpenGL
4.4β- - OpenGL
4.5β- - OpenGL
4.6ββ
so yeah. she's a 4.6 exclusive. if you're on anything older, respectfully, this function does not know you. π
π¦ SEE ALSO π¦
go read these too, they're all in the group chat:
glDrawArrays()glDrawArraysInstanced()glDrawElements()glDrawRangeElements()glDrawArraysIndirect()glMultiDrawArraysIndirect()glMultiDrawElementsIndirect()glMultiDrawElementsIndirectCount()
π COPYRIGHT π
Copyright Β© 2012-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. https://opencontent.org/openpub/.
Copyright Β© 2012-2014 Khronos Group.
okay that's the whole page, you ate that π«Ά this came from [FIXME: source] and it's dated 10/07/2026 β so yeah, it's a GLMULTIDRAWARRAYSIND(3G) page and we're all caught up. now go draw something iconic πβ¨πΈ
π¦ where this page comes from
- arch rolling: opengl-man-pages 20261006-1 Β· SGI-B-2.0 AND OPL-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms