X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fblend.h;h=c4c78d7d51e516fe9e7278c0983dad6446cf6f12;hb=6a4907898281b738111e0c6527cc46f8810dc123;hp=37fc56e17a390132241d0a4761b0c9a6d2692406;hpb=1bff68e595a66f3755743a7ee0f974eb876f3520;p=libs%2Fgl.git diff --git a/source/blend.h b/source/blend.h index 37fc56e1..c4c78d7d 100644 --- a/source/blend.h +++ b/source/blend.h @@ -1,18 +1,24 @@ /* $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 { namespace GL { +enum +{ + BLEND = GL_BLEND +}; + enum BlendEquation { ADD = GL_FUNC_ADD, @@ -40,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 +{ +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);