summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-04-19 01:45:47 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-04-19 01:45:47 +0100
commit4360094ff6e9f4d245f832c58f673ae4d1f75950 (patch)
tree928956db87775cee44fe71e7e0989423c5297d84
parentDrop performance debug to warning and stop disabling error checking for textu... (diff)
downloadilt-4360094ff6e9f4d245f832c58f673ae4d1f75950.tar.bz2
ilt-4360094ff6e9f4d245f832c58f673ae4d1f75950.tar.xz
ilt-4360094ff6e9f4d245f832c58f673ae4d1f75950.zip
Fixup vertexAttribFunc for matrices
-rw-r--r--lib/gl_traits.hpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/gl_traits.hpp b/lib/gl_traits.hpp
index 10b42e5..6ff8905 100644
--- a/lib/gl_traits.hpp
+++ b/lib/gl_traits.hpp
@@ -68,9 +68,9 @@ struct gl_traits<glm::mat<C, R, T, Q>> : public gl_traits<T> {
static constexpr GLint size {C * R};
static constexpr auto vertexAttribFunc {
[](GLuint index, GLint, GLenum type, GLsizei stride, const void * pointer) -> GLuint {
- const auto m = static_cast<glm::mat<C, R, T, Q>>(pointer);
- for (glm::length_t r = 0; r < R; r++) {
- glVertexAttribPointer(index, C, type, GL_FALSE, stride, &m[r]);
+ const auto base = static_cast<const T *>(pointer);
+ for (GLuint r = 0; r < R; r++) {
+ glVertexAttribPointer(index + r, C, type, GL_FALSE, stride, base + (r * C));
}
return R;
}};