giawa / opengl4csharp

OpenGL 4 Bindings (partially based on OpenTK) for C#
Other
232 stars 61 forks source link

VAO method to draw with glMultiDrawElementsIndirect #46

Closed TheAIBot closed 4 years ago

TheAIBot commented 4 years ago

glMultiDrawElementsIndirect can execute multiple draw commands at once from a VBO of commands.

This PR adds the draw command struct DrawElementsIndirectCommand. VBO had to support the new struct and i an not sure i did it in the best way. I just gave it a random VertexAttribPointerType but maybe it should be special cased to a new VertexAttribPointerType.Invalid?.

glMultiDrawElementsIndirect is only supported in OpenGL 4.3, so i added a new method to get the minor OpenGL version number. If OpenGL 4.3 isn't supported then the draw method throws an exception. The new draw command itself takes a VBO of commands so it's possible to swap command buffers between calls if one wishes to do so.