1 #ifndef BLOBS_GRAPHICS_GL_TRAITS_HPP_
2 #define BLOBS_GRAPHICS_GL_TRAITS_HPP_
15 /// number of components per generic attribute
16 /// must be 1, 2, 3, 4
17 // static constexpr GLint size;
20 /// accepted values are:
21 /// GL_BYTE, GL_UNSIGNED_BYTE,
22 /// GL_SHORT, GL_UNSIGNED_SHORT,
23 /// GL_INT, GL_UNSIGNED_INT,
24 /// GL_HALF_FLOAT, GL_FLOAT, GL_DOUBLE,
25 /// GL_FIXED, GL_INT_2_10_10_10_REV, GL_UNSIGNED_INT_2_10_10_10_REV
26 // static constexpr GLenum type;
33 template<> struct gl_traits<signed char> {
34 static constexpr GLint size = 1;
35 static constexpr GLenum type = GL_BYTE;
38 template<> struct gl_traits<unsigned char> {
39 static constexpr GLint size = 1;
40 static constexpr GLenum type = GL_UNSIGNED_BYTE;
43 template<> struct gl_traits<short> {
44 static constexpr GLint size = 1;
45 static constexpr GLenum type = GL_SHORT;
48 template<> struct gl_traits<unsigned short> {
49 static constexpr GLint size = 1;
50 static constexpr GLenum type = GL_UNSIGNED_SHORT;
53 template<> struct gl_traits<int> {
54 static constexpr GLint size = 1;
55 static constexpr GLenum type = GL_INT;
58 template<> struct gl_traits<unsigned int> {
59 static constexpr GLint size = 1;
60 static constexpr GLenum type = GL_UNSIGNED_INT;
63 template<> struct gl_traits<float> {
64 static constexpr GLint size = 1;
65 static constexpr GLenum type = GL_FLOAT;
68 template<> struct gl_traits<double> {
69 static constexpr GLint size = 1;
70 static constexpr GLenum type = GL_DOUBLE;
76 template<class T, glm::precision P>
77 struct gl_traits<glm::tvec1<T, P>> {
78 static constexpr GLint size = 1;
79 static constexpr GLenum type = gl_traits<T>::type;
81 template<class T, glm::precision P>
82 constexpr GLint gl_traits<glm::tvec1<T, P>>::size;
83 template<class T, glm::precision P>
84 constexpr GLenum gl_traits<glm::tvec1<T, P>>::type;
87 template<class T, glm::precision P>
88 struct gl_traits<glm::tvec2<T, P>> {
89 static constexpr GLint size = 2;
90 static constexpr GLenum type = gl_traits<T>::type;
92 template<class T, glm::precision P>
93 constexpr GLint gl_traits<glm::tvec2<T, P>>::size;
94 template<class T, glm::precision P>
95 constexpr GLenum gl_traits<glm::tvec2<T, P>>::type;
98 template<class T, glm::precision P>
99 struct gl_traits<glm::tvec3<T, P>> {
100 static constexpr GLint size = 3;
101 static constexpr GLenum type = gl_traits<T>::type;
103 template<class T, glm::precision P>
104 constexpr GLint gl_traits<glm::tvec3<T, P>>::size;
105 template<class T, glm::precision P>
106 constexpr GLenum gl_traits<glm::tvec3<T, P>>::type;
109 template<class T, glm::precision P>
110 struct gl_traits<glm::tvec4<T, P>> {
111 static constexpr GLint size = 4;
112 static constexpr GLenum type = gl_traits<T>::type;
114 template<class T, glm::precision P>
115 constexpr GLint gl_traits<glm::tvec4<T, P>>::size;
116 template<class T, glm::precision P>
117 constexpr GLenum gl_traits<glm::tvec4<T, P>>::type;