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