Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having trouble understanding the benefit of the newer GL_EXT_draw_instanced over traditional VBO's. Don't both keep geometry cached on the gpu for faster redrawing? VBO's seem much more flexible.

share|improve this question
up vote 6 down vote accepted

The advantage to instancing is to allow multiple objects to be drawn in a single draw-call, reducing the overhead of calling the API.

Typically as well as the geometry, you would also have a buffer containing multiple transforms, and perhaps other per-object data. This could be used in the shader to vary the appearance of each object by modifying its colour, or using a different texture (generally the texture variations would be achieved by using a texture atlas to pack multiple textures into a single texture).

share|improve this answer
This makes sense. VBO's allow rendering lots of vertices in one call. Instancing is one level higher in the hierarchy and lets you render lots of VBO's in one call. – EricP Oct 21 '10 at 18:11

Instancing should be used in conjunction with VBOs, and is most useful in OpenGL3/4.

The "correct" usage is to have a uniform-array of transform matrices, one for each instance. You then use one instanced draw call to render all the objects that use the same mesh. In your vertex shader, you can then select which transformation matrix to use based on the index ID.

You can do the same for any other number of attributes, but the more attributes you want to change, the fewer instances you can draw at once, due to constraints on the number of uniforms available. If you just want to use a transform matrix, for example, thats 4096/16=256 instances at once on the latest-and-greatest hardware. (assuming no other uniforms in your shaders). If you add colors to that, you're down to 4096/20=204 instances at once.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.