diff options
author | Dan Goodliffe <dan.goodliffe@octal.co.uk> | 2023-04-19 14:36:57 +0100 |
---|---|---|
committer | Dan Goodliffe <dan.goodliffe@octal.co.uk> | 2023-04-19 14:36:57 +0100 |
commit | 6b0b13d4b61eb95fb515bd49a8a70a06ea0748ab (patch) | |
tree | 385a0c0403045f1092afb7c4228896eeafdefe31 | |
parent | Add basic instanced shader to those which get the viewProjection configured (diff) | |
download | ilt-6b0b13d4b61eb95fb515bd49a8a70a06ea0748ab.tar.bz2 ilt-6b0b13d4b61eb95fb515bd49a8a70a06ea0748ab.tar.xz ilt-6b0b13d4b61eb95fb515bd49a8a70a06ea0748ab.zip |
Persist vertexArrayId across multiple calls
Allows chaining together to build VAO from multiple buffers
-rw-r--r-- | gfx/gl/vertexArrayObject.hpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gfx/gl/vertexArrayObject.hpp b/gfx/gl/vertexArrayObject.hpp index fdc43e9..2285ed0 100644 --- a/gfx/gl/vertexArrayObject.hpp +++ b/gfx/gl/vertexArrayObject.hpp @@ -88,16 +88,17 @@ private: } template<typename VertexT, MP... attribs> - static void + void configure_attribs(const GLuint arrayBuffer) { glBindBuffer(GL_ARRAY_BUFFER, arrayBuffer); if constexpr (sizeof...(attribs) == 0) { - set_pointer<VertexT, VertexT>(0, nullptr); + vertexArrayId += set_pointer<VertexT, VertexT>(vertexArrayId, nullptr); } else { - GLuint vertexArrayId {}; ((vertexArrayId += set_pointer<VertexT, attribs>(vertexArrayId)), ...); } } + + GLuint vertexArrayId {}; }; |