Reputation: 5641
I'm developping a 3D application using OpenGL.
I have a misconception about a part of the following post: OpenGL VAO best practices
I'm not sure about the meaning of the term 'batch' in this post.
Does it means for each object of the scene ? So does it suggest to create a VAO for each object of the scene or several objects ? Does a batch refers to several objects sharing the same materials, transformations and shading ?
Upvotes: 1
Views: 722
Reputation: 162164
A batch is simply a, well, "batch" (=bunch) of primitives, i.e. points, lines or triangles drawn by making a single glDraw…
call. There's no deeper maging behind this.
Does it means for each object of the scene?
No. OpenGL doesn't know what a "model" is. This concept goes totally beyond what OpenGL does. OpenGL merely draws points, lines or triangles to the screen, and that's it.
So does it suggest to create a VAO for each object of the scene or several objects?
No, it suggests that you create VAOs and VBOs in such a way, that you can coalesce the maximum number of primitives (= triangle | line | point) that can be drawn with a minimum number of glDraw…
calls into a single VAO/VBO.
For example say you'd render a warehouse full of cardboard boxes, where each box has a (slightly) different shape (think of the self service section in an IKEA store; I'm pretty sure those look about the same in every store around the world): Despite being of different shape the boxes have a lot in common: Their color, the texture, etc. So what you would do is put all those boxes into a single VAO/VBO and draw them all together using the same texture and shader through a single, or a handfull of glDraw…
calls.
Upvotes: 2