I have a simple task: I have 10,000 3D boxes, each with a x,y,z, width, height, depth, rotation, and color. I want to throw them into a 3D space, visualize it, and let the user fly through it using the mouse. Is there an easy way to put this together?
Share
One easy way of doing this using recent (v 3.2) OpenGL would be:
glBufferDatato get your array into the vertex buffergl_InstanceIDglDrawElementsInstancedN number of times withcountset to as many elements as will fit into one batchTo communicate the per-cube transform data, you have several alternatives, among them are:
Alternatively: Use pseudo-instancing which will work even on hardware that does not support instancing directly. It is not as elegant and very slightly slower, but it does the job.