From c7396955e9d0437dc24d5ede09724fa47e0693af Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 19 Apr 2023 14:42:11 +0100 Subject: Enable all vertex array attribs configured by vertexAttribFunc --- gfx/gl/vertexArrayObject.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'gfx') diff --git a/gfx/gl/vertexArrayObject.hpp b/gfx/gl/vertexArrayObject.hpp index 2285ed0..92e0325 100644 --- a/gfx/gl/vertexArrayObject.hpp +++ b/gfx/gl/vertexArrayObject.hpp @@ -75,9 +75,13 @@ private: static auto set_pointer(const GLuint vertexArrayId, const void * ptr) { - glEnableVertexAttribArray(vertexArrayId); using traits = gl_traits; - return traits::vertexAttribFunc(vertexArrayId, traits::size, traits::type, sizeof(VertexT), ptr); + const auto usedAttribs + = traits::vertexAttribFunc(vertexArrayId, traits::size, traits::type, sizeof(VertexT), ptr); + for (GLuint i {}; i < usedAttribs; i++) { + glEnableVertexAttribArray(vertexArrayId + i); + } + return usedAttribs; } template -- cgit v1.2.3