X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fblend.h;h=e7b291e617dab5c2044e787c99ee7a09a7dfcac5;hp=37fc56e17a390132241d0a4761b0c9a6d2692406;hb=573ea4e5602c4321cc1d75daf9ed0beed5cde280;hpb=1bff68e595a66f3755743a7ee0f974eb876f3520 diff --git a/source/blend.h b/source/blend.h index 37fc56e1..e7b291e6 100644 --- a/source/blend.h +++ b/source/blend.h @@ -1,14 +1,10 @@ -/* $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 +#include "bindable.h" #include "gl.h" +#include namespace Msp { namespace GL { @@ -40,8 +36,32 @@ enum BlendFactor 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 +{ +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