]> git.tdb.fi Git - libs/gl.git/blob - source/blend.h
Drop Id tags and copyright notices from files
[libs/gl.git] / source / blend.h
1 #ifndef MSP_GL_BLEND_H_
2 #define MSP_GL_BLEND_H_
3
4 #include "bindable.h"
5 #include "gl.h"
6
7 namespace Msp {
8 namespace GL {
9
10 enum BlendEquation
11 {
12         ADD              = GL_FUNC_ADD,
13         SUBTRACT         = GL_FUNC_SUBTRACT,
14         REVERSE_SUBTRACT = GL_FUNC_REVERSE_SUBTRACT,
15         MIN              = GL_MIN,
16         MAX              = GL_MAX
17 };
18
19 enum BlendFactor
20 {
21         ZERO = GL_ZERO,
22         ONE = GL_ONE,
23         SRC_COLOR = GL_SRC_COLOR,
24         ONE_MINUS_SRC_COLOR = GL_ONE_MINUS_SRC_COLOR,
25         SRC_ALPHA = GL_SRC_ALPHA,
26         ONE_MINUS_SRC_ALPHA = GL_ONE_MINUS_SRC_ALPHA,
27         DST_COLOR = GL_DST_COLOR,
28         ONE_MINUS_DST_COLOR = GL_ONE_MINUS_DST_COLOR,
29         DST_ALPHA = GL_DST_ALPHA,
30         ONE_MINUS_DST_ALPHA = GL_ONE_MINUS_DST_ALPHA,
31         CONSTANT_COLOR = GL_CONSTANT_COLOR,
32         ONE_MINUS_CONSTANT_COLOR = GL_ONE_MINUS_CONSTANT_COLOR,
33         CONSTANT_ALPHA = GL_CONSTANT_ALPHA,
34         ONE_MINUS_CONSTANT_ALPHA = GL_ONE_MINUS_CONSTANT_ALPHA
35 };
36
37 /**
38 Blends incoming fragments with those already in the framebuffer.
39 */
40 class Blend: public Bindable<Blend>
41 {
42 private:
43         BlendEquation eq;
44         BlendFactor src_factor;
45         BlendFactor dst_factor;
46
47 public:
48         Blend();
49         Blend(BlendFactor, BlendFactor);
50         Blend(BlendEquation, BlendFactor, BlendFactor);
51
52         void bind() const;
53
54         static void unbind();
55
56         static const Blend &alpha();
57 };
58
59 } // namespace GL
60 } // namespace Msp
61
62 #endif