How many times is gl.DrawElements called?

Tell me how many times THREEjs calls the function gl.DrawElements in one frame. Once ?, or on each object the function is caused.

// Render at once //
ONE gl.DrawElements ( box + sphere + plane ) = SCENE


// Render each object independently //
gl.DrawElements ( box ) + gl.DrawElements ( sphere ) + gl.DrawElements ( plane ) = SCENE

I bad write in English, I’m sorry. I hope my question is clear. Thanks for the answer.

You can see the total amount of draw calls per frame by logging (see live example). There is no individual logging of WebGLRenderingContext.drawElements() or WebGLRenderingContext.drawArrays().

In general, three.js executes for each object a separate draw call. The engine does not perform any form of batching. If you want to reduce the amount of draw calls, you have to perform manual actions like merging geometries or use instanced rendering.

1 Like

Thanks for the answer.