I would like to make a game out of many cubes and am planning on putting it on mobile platforms and also on the web using webgl. My problem is when I make a drawelements call per cube I take a hit on the frame rate. Is there a way I can make a single draw call to opengl es to draw them? The only difference between the cubes would be position and color.
I ran into same problem myself. I asked similar question and answered it myself yesterday. Take a look at:
Efficient way of drawing in OpenGL ES
You want to create your vertex buffers and upload them to graphics card memory only once using gl.bufferData. Then use reference to that buffer each time you do gl.drawElements or gl.drawArrays. Until the next time the content of your 3D scene changes, you can use this buffer that is uploaded in graphics card memory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With