diff options
author | Dan Goodliffe <dan.goodliffe@octal.co.uk> | 2023-04-19 14:42:11 +0100 |
---|---|---|
committer | Dan Goodliffe <dan.goodliffe@octal.co.uk> | 2023-04-19 14:43:47 +0100 |
commit | c7396955e9d0437dc24d5ede09724fa47e0693af (patch) | |
tree | e5cc9906cb58183207518c062e818d8d518b2fe4 /gfx/gl/vertexArrayObject.hpp | |
parent | Persist vertexArrayId across multiple calls (diff) | |
download | ilt-c7396955e9d0437dc24d5ede09724fa47e0693af.tar.bz2 ilt-c7396955e9d0437dc24d5ede09724fa47e0693af.tar.xz ilt-c7396955e9d0437dc24d5ede09724fa47e0693af.zip |
Enable all vertex array attribs configured by vertexAttribFunc
Diffstat (limited to 'gfx/gl/vertexArrayObject.hpp')
-rw-r--r-- | gfx/gl/vertexArrayObject.hpp | 8 |
1 files changed, 6 insertions, 2 deletions
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<T>; - 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<typename VertexT, MP attrib> |