From 6b0b13d4b61eb95fb515bd49a8a70a06ea0748ab Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 19 Apr 2023 14:36:57 +0100 Subject: Persist vertexArrayId across multiple calls Allows chaining together to build VAO from multiple buffers --- gfx/gl/vertexArrayObject.hpp | 7 ++++--- 1 file 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 - static void + void configure_attribs(const GLuint arrayBuffer) { glBindBuffer(GL_ARRAY_BUFFER, arrayBuffer); if constexpr (sizeof...(attribs) == 0) { - set_pointer(0, nullptr); + vertexArrayId += set_pointer(vertexArrayId, nullptr); } else { - GLuint vertexArrayId {}; ((vertexArrayId += set_pointer(vertexArrayId)), ...); } } + + GLuint vertexArrayId {}; }; -- cgit v1.2.3