I'm using WebGL and I want to render a single mesh many times at different locations. I know about WebGL 2's drawArraysInstanced()
and drawElementsInstanced()
calls, but I think only Firefox supports them now.
The only solutions I see are :
Put all the meshes in a single buffer and render it with a single call to
drawArrays()
/drawElements()
, but that would be a waste of memory because the mesh contains a lot of vertices and if the meshes are not static I would need to re-load the vertices in gpu memory every frame or so.Have a single mesh in memory and render each instance with a separate call to
drawArrays()
/drawElements()
, updating the model matrix between each call. I don't think that's the best way.
Any ideas? Thanks