I'm having trouble understanding exactly what glMultiDraw* does, and when it should be used.

Is it to be used if I have one VBO with multiple objects in it or do I use it with many VBO's?

It would be great if someone could give a real example of how to use this is a VAO/VBO as all the stuff I've found on google just explain what the function does rather that how to use it practically.

  • \$\begingroup\$ I've done some minor editing to try to make the question clearer and easier for others to find in a search. If you disagree with the edit, please revert it. :) \$\endgroup\$ Commented Sep 6, 2014 at 0:35

2 Answers 2


As per the documentation for glMultiDrawArrays and its sister glMultiDrawElements, these functions behave exactly the same as their glDraw* counterparts, except that they can specify more than one object. This means you bind all the same objects and use all the same state as with a glDraw* command.

The practical upshot of this is that yes, you can have one VBO with multiple objects in it, and render all of them with one API call.

I will direct you to this page for a more thorough discussion.

See also pages 34 (3.3) and 349 (4.5) of the OpenGL standards.

  • \$\begingroup\$ What do you mean by "bind all the same objects" you mean bind many (vertex)buffer objects? Because if that's the case then it's not possible. \$\endgroup\$
    – Soapy
    Commented Sep 5, 2014 at 16:07
  • \$\begingroup\$ No, glMultiDraw* commands both require a bound VAO and VBO (and index buffer for -Elements), just like their glDraw* counterparts. with glMultiDraw* commands you can pack multiple objects into one VBO and render them all at once. \$\endgroup\$ Commented Sep 5, 2014 at 16:09
  • \$\begingroup\$ For example, let's say you have a cube, a triangle, and a sphere. With glDrawArrays you might create a VBO for each and have some loop where you bind the right VBO and issue the draw command. With glMultiDrawArrays you can shove them into one VBO and issue one command and the driver will happily do the rest of the magic for you. \$\endgroup\$ Commented Sep 5, 2014 at 16:18

Take this code:

for (int i = 0; i < numarrays; i++)
    glDrawArrays (GL_TRIANGLE_FAN, arrayfirsts[i], arraycounts[i]);

Multi-draw allows this to be executed with a single draw call:

glMultiDrawArrays (GL_TRIANGLE_FAN, arrayfirsts, arraycounts, numarrays);

In theory this can give you better performance: by having only a single draw call, the driver need (again, in theory) only perform setup and validation once rather than once per draw call.

It's actually got nothing to do with VBOs explicitly, because it dates to GL 1.4; i.e before VBOs were added to OpenGL. Instead it provides you with a method of batching multiple draw calls to a single draw call, which is something that all GPU vendors recommend.

I made a point of emphasising "in theory" above, because in practice it's performance is going to depend on how the driver implements it. Some drivers may implement it entirely in software, and just treat it as a loop of individual glDrawArrays calls. Others may be able to take a faster path with it. OpenGL makes no promises either way.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .