]> git.tdb.fi Git - libs/gl.git/blob - source/texenv.h
Enhance the extension generator to support different APIs
[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         enum ParameterMask
24         {
25                 MODE = 1,
26                 COLOR = 2
27         };
28
29         TexEnvMode mode;
30         Color color;
31
32 public:
33         TexEnv();
34         ~TexEnv();
35
36         static const TexEnv &default_object();
37
38 private:
39         void update_parameter(int) const;
40
41 public:
42         void set_mode(TexEnvMode);
43         void set_color(const Color &);
44         TexEnvMode get_mode() const { return mode; }
45         const Color &get_color() const { return color; }
46         void bind() const { bind_to(0); }
47         void bind_to(unsigned) const;
48
49         static const TexEnv *current(unsigned = 0);
50         static void unbind() { unbind_from(0); }
51         static void unbind_from(unsigned);
52 };
53
54 } // namespace GL
55 } // namespace Msp
56
57 #endif