-/* $Id$
-
-This file is part of libmspgl
-Copyright © 2008 Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
#ifndef MSP_GL_BLEND_H_
#define MSP_GL_BLEND_H_
+#include <msp/strings/lexicalcast.h>
+#include "bindable.h"
#include "gl.h"
+#include <msp/gl/extensions/ext_blend_minmax.h>
namespace Msp {
namespace GL {
ONE_MINUS_CONSTANT_ALPHA = GL_ONE_MINUS_CONSTANT_ALPHA
};
-void blend_equation(BlendEquation eq);
-void blend_func(BlendFactor src, BlendFactor dst);
+/**
+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 void unbind();
+
+ static const Blend &alpha();
+ static const Blend &additive();
+ static const Blend &additive_alpha();
+};
+
+void operator>>(const LexicalConverter &, BlendFactor &);
+void operator<<(LexicalConverter &, BlendFactor);
} // namespace GL
} // namespace Msp