summaryrefslogtreecommitdiff
path: root/gfx/gl/vertexArrayObject.hpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-04-18 00:08:18 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-04-18 00:08:18 +0100
commit21459ac4c92b82f2a3eeb1d9a6b462726001084c (patch)
tree17ef14ecfb67b9f247685c8eba36210023beff06 /gfx/gl/vertexArrayObject.hpp
parentSeparate storing of mesh vertex/index data from configuring VAO (diff)
downloadilt-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/vertexArrayObject.hpp')
-rw-r--r--gfx/gl/vertexArrayObject.hpp10
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)), ...);
}
}
};