]> git.tdb.fi Git - libs/gl.git/blob - source/uniform.cpp
Rewrite the Uniform classes as templates
[libs/gl.git] / source / uniform.cpp
1 #include "arb_shader_objects.h"
2 #include "uniform.h"
3
4 namespace Msp {
5 namespace GL {
6
7 template<>
8 void UniformScalar<int>::apply(int index) const
9 {
10         glUniform1iARB(index, value);
11 }
12
13 template<>
14 void UniformScalar<float>::apply(int index) const
15 {
16         glUniform1fARB(index, value);
17 }
18
19
20 template<>
21 void UniformVector<float, 2>::apply(int index) const
22 {
23         glUniform2fvARB(index, 1, value);
24 }
25
26 template<>
27 void UniformVector<float, 3>::apply(int index) const
28 {
29         glUniform3fvARB(index, 1, value);
30 }
31
32 template<>
33 void UniformVector<float, 4>::apply(int index) const
34 {
35         glUniform4fvARB(index, 1, value);
36 }
37
38
39 template<>
40 void UniformMatrix<float, 4, 4>::apply(int index) const
41 {
42         glUniformMatrix4fvARB(index, 1, false, value);
43 }
44
45 } // namespace GL
46 } // namespace Msp