diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-01-02 17:13:01 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-01-02 17:13:01 +0000 |
commit | 349dd957ea05c1cd9289646db6888a993c8ee02f (patch) | |
tree | 7d6ab8198679d4b9e3e11d0af6a87dd777409cbc /lib/gl_traits.hpp | |
parent | VertexArrayObject helper supports binding an entire object, not just fields (diff) | |
download | ilt-349dd957ea05c1cd9289646db6888a993c8ee02f.tar.bz2 ilt-349dd957ea05c1cd9289646db6888a993c8ee02f.tar.xz ilt-349dd957ea05c1cd9289646db6888a993c8ee02f.zip |
Add gl_traits for all the common types
Diffstat (limited to 'lib/gl_traits.hpp')
-rw-r--r-- | lib/gl_traits.hpp | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/lib/gl_traits.hpp b/lib/gl_traits.hpp index b50ec50..d140de9 100644 --- a/lib/gl_traits.hpp +++ b/lib/gl_traits.hpp @@ -3,12 +3,41 @@ #include <GL/glew.h> #include <array> #include <glm/common.hpp> +#include <glm/fwd.hpp> template<typename T> struct gl_traits; -template<> struct gl_traits<float> { +template<> struct gl_traits<glm::f32> { static constexpr GLenum type {GL_FLOAT}; static constexpr GLint size {1}; }; +template<> struct gl_traits<glm::f64> { + static constexpr GLenum type {GL_DOUBLE}; + static constexpr GLint size {1}; +}; +template<> struct gl_traits<glm::int8> { + static constexpr GLenum type {GL_BYTE}; + static constexpr GLint size {1}; +}; +template<> struct gl_traits<glm::int16> { + static constexpr GLenum type {GL_SHORT}; + static constexpr GLint size {1}; +}; +template<> struct gl_traits<glm::int32> { + static constexpr GLenum type {GL_INT}; + static constexpr GLint size {1}; +}; +template<> struct gl_traits<glm::uint8> { + static constexpr GLenum type {GL_UNSIGNED_BYTE}; + static constexpr GLint size {1}; +}; +template<> struct gl_traits<glm::uint16> { + static constexpr GLenum type {GL_UNSIGNED_SHORT}; + static constexpr GLint size {1}; +}; +template<> struct gl_traits<glm::uint32> { + static constexpr GLenum type {GL_UNSIGNED_INT}; + static constexpr GLint size {1}; +}; template<typename T, std::size_t S> struct gl_traits<std::array<T, S>> : public gl_traits<T> { static constexpr GLint size {S * gl_traits<T>::size}; |