# Most efficient way to draw large number of the same objects, but with different transforms

I'd like to draw a large number (multiple thousands) of simple meshes (each maybe... a maximum of 50 triangles, but even that is a very large upper bound), all of which are exactly the same.

As a simple brute force way, right now I'm just doing thousands of draw calls, where I just change the transformation matrices that the shaders need and then draw the same objects again.

Of course this is hideously slow, since (I'm guessing) there are too many draw calls for the driver and my PC to handle efficiently.

What can I do to make it faster?

• I can't give you a complete answer, but the high-level answer is to use geometry instancing. – Seth Battin Aug 3 '13 at 23:12
• Search google for "Geometry Instancing", maybe you can find something that helps you that way – Luis W Aug 3 '13 at 23:13

The solution to this is instancing. This tutorial explains a few methods of instancing. If you have ARB_draw_instanced and ARB_instanced_arrays, use them.
The general idea is to store all of your meshes' transforms in a separate buffer object and bind that to an attribute array that uses one "vertex" per instance via glVertexAttribDivisor.
• @TravisG I tend to try and support older versions. I understand both those extensions have been promoted to core for a while, the extension string will still be present, however :). Also, using glVertexAttribDivisor (which is not deprecated or outdated by any means) has the benefit of not having an upper limit on instance count. Performance has been historically better than uniform buffers, but is probably the same or very similar now, and both ways get the job done. – Robert Rouhani Aug 4 '13 at 3:03