Answer the question
In order to leave comments, you need to log in
How to properly draw multiple objects in webgl?
Can you please tell me why in many articles on webgl the drawing function (drawArrays/drawElements) is called for each object? Isn't it better to draw at once?
I also looked into the ThreeJS library, it does the same thing there. Maybe there is some kind of intermediate buffer and so faster?
Answer the question
In order to leave comments, you need to log in
Because it will be necessary for each frame to first shove all the objects into one buffer, and then draw it, it will be more expensive. And so, each object in its own buffer and draw as we want. Plus, how do you turn on different shaders and textures for different objects if they are drawn with one call?
Further, if you have 100 identical objects, you will have to make a buffer the size of 100 objects, instead of drawing from one buffer 100 times in a row.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question