summaryrefslogtreecommitdiff
path: root/gfx
diff options
context:
space:
mode:
authorDan Goodliffe <dan.goodliffe@octal.co.uk>2023-04-19 14:42:11 +0100
committerDan Goodliffe <dan.goodliffe@octal.co.uk>2023-04-19 14:43:47 +0100
commitc7396955e9d0437dc24d5ede09724fa47e0693af (patch)
treee5cc9906cb58183207518c062e818d8d518b2fe4 /gfx
parentPersist vertexArrayId across multiple calls (diff)
downloadilt-c7396955e9d0437dc24d5ede09724fa47e0693af.tar.bz2
ilt-c7396955e9d0437dc24d5ede09724fa47e0693af.tar.xz
ilt-c7396955e9d0437dc24d5ede09724fa47e0693af.zip
Enable all vertex array attribs configured by vertexAttribFunc
Diffstat (limited to 'gfx')
-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>