From c00dacdb573d3e090a092e5725bb3eb7137d0098 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 27 Jan 2024 21:37:59 +0000 Subject: Add traits vertex attrib func override for arrays Address limitation on size when specifying arrays of glm::vec --- lib/gl_traits.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/gl_traits.h b/lib/gl_traits.h index 14ac9d8..b3c6909 100644 --- a/lib/gl_traits.h +++ b/lib/gl_traits.h @@ -83,6 +83,14 @@ template<> struct gl_traits : public gl_traits_integer { template struct gl_traits> : public gl_traits { static constexpr GLint size {S * gl_traits::size}; + static constexpr auto vertexAttribFunc { + [](GLuint index, GLint, GLenum type, GLsizei stride, const void * pointer) -> GLuint { + const auto base = static_cast(pointer); + for (GLuint e = 0; e < S; e++) { + glVertexAttribPointer(index + e, gl_traits::size, type, GL_FALSE, stride, base + e); + } + return S; + }}; }; template struct gl_traits> : public gl_traits { -- cgit v1.2.3