I am rendering lot of axis aligned 3D cubes. Each cube can be different from one another by the location of its center of the cube and/or color. This is how, I am rendering it right now
for (i = 0; i < num_of_cubes; ++i) {
glTranslatef(center[i].x, center[i].y, center[i].z);
DrawCube();
}
My DrawCube() simply renders 6 quads corresponding to each side of the cube, using glDrawElements with vertex data stored in VBO. glVertexPointer and glColorPointer is used to set the attribute elements.
This works, but I want to use Instanced rendering by making use of probably glDrawElementsInstanced(). However due to some legacy code of the project, I have to use fixed function pipeline.
Is it possible to do this with fixed pipeline? If yes how do I tell my GPU to use the Instance vbo of voxel centers and colors.