drawelements for many identical objects

I would like to draw many cubes however when I get to around 100 it starts to slow the frame rate down. Is there a way I can make a single draw call to open gl to draw them instead of making a drawelements call for every cube. The only difference between the cubes would be position and color.

Hi

Maybe use a display list, a compiled vertex array or a single static intervealed (containing both vertex coordinates and colors) VBO. Don’t use glMultiDrawArrays, it does not give any boost.

I’d suggest grabbing nvidia’s SDK from here: http://developer.nvidia.com/page/home.html and looking at the instancing and pseudo-instancing techniques.

It is a good idea. GL_ARB_draw_instanced requires at least OpenGL 2.0 and a good knowledge of vertex shaders (you have to get the instance identifier inside the vertex shader and then to “move” your object). I rarely use shaders…