@@ -101,7 +101,7 @@ just an extra large buffer on the GPU we can use. A uniform buffer object is
101101similar, but faster, it is however, much smaller too.
102102``` cpp
103103std::vector<Material> mesh_materials = ...;
104- glNamedBufferData (material_buffer, mesh_materials.size() * sizeof(material), mesh_materials.data(), flags)
104+ glNamedBufferData (material_buffer, mesh_materials.size() * sizeof(material), mesh_materials.data(), flags);
105105glBindBufferBase(GL_SHADER_STORAGE_BUFFER, binding, material_buffer);
106106```
107107Inefficiency aside, let's assume the `mesh_materials` contains the material
@@ -176,13 +176,13 @@ It just read my mind. With OpenGL Multi Draw Indirect (MDI), commands can be
176176stored and then sent all at once.
177177``` cpp
178178struct DrawCommand {
179- std::uint32_t count; // how many indices
180- std::uint32_t instance_count; // how many instances to draw
181- std::uint32_t first_index; // offset to the first indice
182- std::uint32_t base_vertex; // offset to the first vertex
183- std::uint32_t base_instance; // offset for when drawing multiple instances
179+ std::uint32_t count; // how many indices
180+ std::uint32_t instance_count; // how many instances to draw
181+ std::uint32_t first_index; // offset to the first indice
182+ std::uint32_t base_vertex; // offset to the first vertex
183+ std::uint32_t base_instance; // offset for when drawing multiple instances
184184};
185- std::vector<DrawCommand > commands
185+ std::vector<DrawCommand > commands;
186186
187187glNamedBufferStorage(command_buffer, sizeof(DrawCommand) * commands.size(), commands.data(), GL_DYNAMIC_STORAGE_BIT);
188188glBindBuffer(GL_DRAW_INDIRECT_BUFFER, command_buffer);
0 commit comments