openframeworks/openFrameworks — pull request #2225 by tgfrerer (2013-07-12 11:50:32+00:00)
Title: add ability to draw VBOs instanced

This PR proposes to add two methods to ofVbo's API:

ofVbo::drawInstanced(int drawMode, int first, int total, int primCount)
ofVbo::drawElementsInstanced(int drawMode, int amt, int primCount)

The syntax is the same as for "regular" draw calls, but for the last qualifier, allowing you to request primCount numbers of instances of the Vbo to be rendered in one draw call.

These methods extend ofVbo's functionality to request instanced rendering of geometry when using fixed function GL or programmable GL.

Instanced drawing, being a key feature of OpenGL Vbos, is insanely useful when drawing lots of similar objects (like blades of grass, trees, or any kind of particles =)

It allows you to render massive amounts of geometry effectively, *without* clogging the memory bus; as discussed in: http://poniesandlight.co.uk/code/ofxVboMeshInstanced/

See also pp. 496 in the Blue Book

Signed-off-by: tgfrerer