From 5a0ecd5c4f0d286926cc333d3c30d5e2df07c883 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 2 Jan 2023 15:05:21 +0000 Subject: Add a traits struct to lookup sizes/type enums for passing to OpenGL --- lib/gl_traits.hpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 lib/gl_traits.hpp diff --git a/lib/gl_traits.hpp b/lib/gl_traits.hpp new file mode 100644 index 0000000..b50ec50 --- /dev/null +++ b/lib/gl_traits.hpp @@ -0,0 +1,24 @@ +#pragma once + +#include +#include +#include + +template struct gl_traits; +template<> struct gl_traits { + static constexpr GLenum type {GL_FLOAT}; + static constexpr GLint size {1}; +}; + +template struct gl_traits> : public gl_traits { + static constexpr GLint size {S * gl_traits::size}; +}; + +template struct gl_traits> : public gl_traits { + static constexpr GLint size {L}; +}; + +template +struct gl_traits> : public gl_traits { + static constexpr GLint size {C * R}; +}; -- cgit v1.2.3