Hi,
I'm looking for the best way to render several millions of cubes. I have for example 2millions cubes, differents sizes but all aligned in the same way.
My solutions for now is:
- Compute normal vectors for each face (front, back, top, etc..).
- Loading all data in 6 VAO/VBOs, one by face (one for each front face of all cubes, one for each back face, etc...). For each cube, I load 4vertices (3float per vertex) in each VBO.
- Drawing each VBO with. My normal for this face is set before as a uniform in my vertex shader.Code :glDrawArrays(GL_QUADS, 0, 4*nbCubes);
Is there a better way to do that?
I tried to use one VBO with only 8vertices (instead of 6*4=24 in my solution) and using glDrawElements but I can't store indices for each cube. And millions calls to glDrawElements doesn't seem good.
I have already increased my number of VBOs in order to get VBO of 4Mb.
What techniques can I use if I can't load everything in the GPU?
Thanks.



