# Handle vertex indicies in a vbo batch drawing call

I'm new in the OpenGL 2 world and want to render a lot of cubes (> 150.000).

How can I render such kind of cubes in practise?

My idea is to split the cubes to a set of vbo's (Maybe 2000 cubes per vbo). Should I upload all cubes in one vbo or could I get a better performance with this approach?

Generally I have a problem, if I do a batch drawing call. On design side, I want to add some structure to my code, so I want to work with object-oriented programming for my cubes. In time each cube is a object from the class cube.cpp. The class contains, among other things, the verticies for geometry, color and indicies.

My problem in oop is to manage the indicies for the verticies of each shape. Has someone an idea to manage the indices?

## 1 Answer

If you upload VBOs with many identical cubes inside of them you will just waste bus bandwidth. The keyword you should search for is "instanced rendering". There are many questions about it on here.

• Is instanced rendering possible on older opengl versions (opengl 2.1 and opengl es 2.0) ? – 501 - not implemented Jan 15 '15 at 15:21
• You need to check for the extensions GL_ARB_draw_instanced and GL_ARB_instanced_arrays (the latter allows using VBOs as source). Here is a hardware support matrix (look for OpenGL 2 drivers). Looks like many support it feedback.wildfiregames.com/report/opengl/feature/… feedback.wildfiregames.com/report/opengl/feature/… – bogglez Jan 15 '15 at 21:15
• Okay, it is supported by my driver. Thank you, I will test it – 501 - not implemented Jan 15 '15 at 21:24
• I'm tested a little bit. But without success. I read that for GL_ARB_Draw EXT_gpu_shader4 or NV_vertex_program4 or OpenGL 3.0 is required . but this is not in my system – 501 - not implemented Jan 16 '15 at 3:28