Currently, the code in WebGL.js uses gl.drawElements to draw all entities, constructing a 'dummy' index buffer for non-indexed meshes (which are in fact all current meshes except for those constructed using WebGL.indexedTriangles).
It would be better to use gl.drawArrays instead for non-indexed meshes; this would have a few advantages:
less memory required on the GPU
less work on the CPU constructing the dummy index buffer
most importantly, it would remove the current restriction where (if I recall correctly) only up to 65536 vertices can be supported in a single mesh, since WebGL uses 16-bit vertex indices; there is no such restriction on the number of points/lines/triangles to draw using gl.drawArrays, since they don't have explicit indices
Currently, the code in WebGL.js uses
gl.drawElements
to draw all entities, constructing a 'dummy' index buffer for non-indexed meshes (which are in fact all current meshes except for those constructed usingWebGL.indexedTriangles
).It would be better to use
gl.drawArrays
instead for non-indexed meshes; this would have a few advantages:gl.drawArrays
, since they don't have explicit indices