]> git.tdb.fi Git - libs/gl.git/blobdiff - source/blend.h
Add object-oriented interfaces for the various tests and blending
[libs/gl.git] / source / blend.h
index 27e76d6469ccb7ea6ab52aee8cb00e29dcdef5a5..c4c78d7d51e516fe9e7278c0983dad6446cf6f12 100644 (file)
@@ -1,13 +1,14 @@
 /* $Id$
 
 This file is part of libmspgl
-Copyright © 2008  Mikko Rasa, Mikkosoft Productions
+Copyright © 2008, 2010  Mikko Rasa, Mikkosoft Productions
 Distributed under the LGPL
 */
 
 #ifndef MSP_GL_BLEND_H_
 #define MSP_GL_BLEND_H_
 
+#include "bindable.h"
 #include "gl.h"
 
 namespace Msp {
@@ -45,6 +46,27 @@ enum BlendFactor
        ONE_MINUS_CONSTANT_ALPHA = GL_ONE_MINUS_CONSTANT_ALPHA
 };
 
+/**
+Blends incoming fragments with those already in the framebuffer.
+*/
+class Blend: public Bindable<Blend>
+{
+private:
+       BlendEquation eq;
+       BlendFactor src_factor;
+       BlendFactor dst_factor;
+
+public:
+       Blend();
+       Blend(BlendFactor, BlendFactor);
+       Blend(BlendEquation, BlendFactor, BlendFactor);
+
+       void bind() const;
+
+       static const Blend &alpha();
+       static void unbind();
+};
+
 void blend_equation(BlendEquation eq);
 void blend_func(BlendFactor src, BlendFactor dst);