]> git.tdb.fi Git - libs/gl.git/blob - source/texenv.h
Always bind textures in a specific texture unit
[libs/gl.git] / source / texenv.h
1 #ifndef MSP_GL_TEXENV_H_
2 #define MSP_GL_TEXENV_H_
3
4 #include "color.h"
5 #include "gl.h"
6
7 namespace Msp {
8 namespace GL {
9
10 enum TexEnvMode
11 {
12         REPLACE  = GL_REPLACE,
13         MODULATE = GL_MODULATE,
14         DECAL    = GL_DECAL,
15         BLEND    = GL_BLEND,
16         ADD      = GL_ADD,
17         COMBINE  = GL_COMBINE
18 };
19
20 class TexEnv
21 {
22 private:
23         TexEnvMode mode;
24         Color color;
25
26 public:
27         TexEnv();
28         void set_mode(TexEnvMode);
29         void set_color(const Color &);
30         TexEnvMode get_mode() const { return mode; }
31         const Color &get_color() const { return color; }
32         void bind() const { bind_to(0); }
33         void bind_to(unsigned) const;
34
35         static const TexEnv *current(unsigned = 0);
36         static void unbind() { unbind_from(0); }
37         static void unbind_from(unsigned);
38 };
39
40 } // namespace GL
41 } // namespace Msp
42
43 #endif