diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-04-18 00:08:18 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-04-18 00:08:18 +0100 |
commit | 21459ac4c92b82f2a3eeb1d9a6b462726001084c (patch) | |
tree | 17ef14ecfb67b9f247685c8eba36210023beff06 /gfx/gl | |
parent | Separate storing of mesh vertex/index data from configuring VAO (diff) | |
download | ilt-21459ac4c92b82f2a3eeb1d9a6b462726001084c.tar.bz2 ilt-21459ac4c92b82f2a3eeb1d9a6b462726001084c.tar.xz ilt-21459ac4c92b82f2a3eeb1d9a6b462726001084c.zip |
Specialize vertexAttribFunc for matrices because there's an upper limit of size 4 on attrib pointers
Diffstat (limited to 'gfx/gl')
-rw-r--r-- | gfx/gl/vertexArrayObject.hpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gfx/gl/vertexArrayObject.hpp b/gfx/gl/vertexArrayObject.hpp index 8c828c8..fdc43e9 100644 --- a/gfx/gl/vertexArrayObject.hpp +++ b/gfx/gl/vertexArrayObject.hpp @@ -72,19 +72,19 @@ public: private: template<typename VertexT, typename T> - static void + static auto set_pointer(const GLuint vertexArrayId, const void * ptr) { glEnableVertexAttribArray(vertexArrayId); using traits = gl_traits<T>; - traits::vertexAttribFunc(vertexArrayId, traits::size, traits::type, sizeof(VertexT), ptr); + return traits::vertexAttribFunc(vertexArrayId, traits::size, traits::type, sizeof(VertexT), ptr); } template<typename VertexT, MP attrib> - static void + static auto set_pointer(const GLuint vertexArrayId) { - set_pointer<VertexT, typename decltype(attrib)::value_type>(vertexArrayId, attrib); + return set_pointer<VertexT, typename decltype(attrib)::value_type>(vertexArrayId, attrib); } template<typename VertexT, MP... attribs> @@ -97,7 +97,7 @@ private: } else { GLuint vertexArrayId {}; - (set_pointer<VertexT, attribs>(vertexArrayId++), ...); + ((vertexArrayId += set_pointer<VertexT, attribs>(vertexArrayId)), ...); } } }; |