summaryrefslogtreecommitdiff
path: root/gfx/gl/vertexArrayObject.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/gl/vertexArrayObject.hpp')
-rw-r--r--gfx/gl/vertexArrayObject.hpp8
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>