1 #ifndef TACOS_GRAPHICS_GL_TRAITS_HPP_
2 #define TACOS_GRAPHICS_GL_TRAITS_HPP_
13 /// number of components per generic attribute
14 /// must be 1, 2, 3, 4
15 // static constexpr GLint size;
18 /// accepted values are:
19 /// GL_BYTE, GL_UNSIGNED_BYTE,
20 /// GL_SHORT, GL_UNSIGNED_SHORT,
21 /// GL_INT, GL_UNSIGNED_INT,
22 /// GL_HALF_FLOAT, GL_FLOAT, GL_DOUBLE,
23 /// GL_FIXED, GL_INT_2_10_10_10_REV, GL_UNSIGNED_INT_2_10_10_10_REV
24 // static constexpr GLenum type;
31 template<> struct gl_traits<signed char> {
32 static constexpr GLint size = 1;
33 static constexpr GLenum type = GL_BYTE;
36 template<> struct gl_traits<unsigned char> {
37 static constexpr GLint size = 1;
38 static constexpr GLenum type = GL_UNSIGNED_BYTE;
41 template<> struct gl_traits<short> {
42 static constexpr GLint size = 1;
43 static constexpr GLenum type = GL_SHORT;
46 template<> struct gl_traits<unsigned short> {
47 static constexpr GLint size = 1;
48 static constexpr GLenum type = GL_UNSIGNED_SHORT;
51 template<> struct gl_traits<int> {
52 static constexpr GLint size = 1;
53 static constexpr GLenum type = GL_INT;
56 template<> struct gl_traits<unsigned int> {
57 static constexpr GLint size = 1;
58 static constexpr GLenum type = GL_UNSIGNED_INT;
61 template<> struct gl_traits<float> {
62 static constexpr GLint size = 1;
63 static constexpr GLenum type = GL_FLOAT;
66 template<> struct gl_traits<double> {
67 static constexpr GLint size = 1;
68 static constexpr GLenum type = GL_DOUBLE;
74 template<class T, glm::precision P>
75 struct gl_traits<glm::tvec1<T, P>> {
76 static constexpr GLint size = 1;
77 static constexpr GLenum type = gl_traits<T>::type;
79 template<class T, glm::precision P>
80 constexpr GLint gl_traits<glm::tvec1<T, P>>::size;
81 template<class T, glm::precision P>
82 constexpr GLenum gl_traits<glm::tvec1<T, P>>::type;
85 template<class T, glm::precision P>
86 struct gl_traits<glm::tvec2<T, P>> {
87 static constexpr GLint size = 2;
88 static constexpr GLenum type = gl_traits<T>::type;
90 template<class T, glm::precision P>
91 constexpr GLint gl_traits<glm::tvec2<T, P>>::size;
92 template<class T, glm::precision P>
93 constexpr GLenum gl_traits<glm::tvec2<T, P>>::type;
96 template<class T, glm::precision P>
97 struct gl_traits<glm::tvec3<T, P>> {
98 static constexpr GLint size = 3;
99 static constexpr GLenum type = gl_traits<T>::type;
101 template<class T, glm::precision P>
102 constexpr GLint gl_traits<glm::tvec3<T, P>>::size;
103 template<class T, glm::precision P>
104 constexpr GLenum gl_traits<glm::tvec3<T, P>>::type;
107 template<class T, glm::precision P>
108 struct gl_traits<glm::tvec4<T, P>> {
109 static constexpr GLint size = 4;
110 static constexpr GLenum type = gl_traits<T>::type;
112 template<class T, glm::precision P>
113 constexpr GLint gl_traits<glm::tvec4<T, P>>::size;
114 template<class T, glm::precision P>
115 constexpr GLenum gl_traits<glm::tvec4<T, P>>::type;