summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/gl_traits.hpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/gl_traits.hpp b/lib/gl_traits.hpp
index e2e689d..10b42e5 100644
--- a/lib/gl_traits.hpp
+++ b/lib/gl_traits.hpp
@@ -11,20 +11,23 @@ struct gl_traits_base {
};
struct gl_traits_float : public gl_traits_base {
static constexpr auto vertexAttribFunc {
- [](GLuint index, GLint size, GLenum type, GLsizei stride, const void * pointer) {
+ [](GLuint index, GLint size, GLenum type, GLsizei stride, const void * pointer) -> GLuint {
glVertexAttribPointer(index, size, type, GL_FALSE, stride, pointer);
+ return 1;
}};
};
struct gl_traits_longfloat : public gl_traits_base {
static constexpr auto vertexAttribFunc {
- [](GLuint index, GLint size, GLenum type, GLsizei stride, const void * pointer) {
+ [](GLuint index, GLint size, GLenum type, GLsizei stride, const void * pointer) -> GLuint {
glVertexAttribLPointer(index, size, type, stride, pointer);
+ return 1;
}};
};
struct gl_traits_integer : public gl_traits_base {
static constexpr auto vertexAttribFunc {
- [](GLuint index, GLint size, GLenum type, GLsizei stride, const void * pointer) {
+ [](GLuint index, GLint size, GLenum type, GLsizei stride, const void * pointer) -> GLuint {
glVertexAttribIPointer(index, size, type, stride, pointer);
+ return 1;
}};
};
template<> struct gl_traits<glm::f32> : public gl_traits_float {
@@ -63,4 +66,12 @@ template<glm::length_t L, typename T, glm::qualifier Q> struct gl_traits<glm::ve
template<glm::length_t C, glm::length_t R, typename T, glm::qualifier Q>
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]);
+ }
+ return R;
+ }};
};