X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fblend.cpp;h=df4043e29fcfc228a557a7a5f54238d1f302f5e2;hb=e69287d99126a20326d713c9a44360f15c94d137;hp=b2f59e17c5cb57250f20aba14ca158e81c818285;hpb=c473f9193d3e5088772b6e5ebf53b710e2976a92;p=libs%2Fgl.git diff --git a/source/blend.cpp b/source/blend.cpp index b2f59e17..df4043e2 100644 --- a/source/blend.cpp +++ b/source/blend.cpp @@ -1,13 +1,6 @@ -/* $Id$ - -This file is part of libmspgl -Copyright © 2008, 2010 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - +#include +#include #include "blend.h" -#include "extension.h" -#include "version_1_2.h" namespace Msp { namespace GL { @@ -29,8 +22,10 @@ Blend::Blend(BlendEquation e, BlendFactor sf, BlendFactor df): src_factor(sf), dst_factor(df) { - if(eq!=ADD) - static RequireVersion _ver(1, 2); + if(eq==MIN || eq==MAX) + static Require _req(EXT_blend_minmax); + else if(eq==SUBTRACT || eq==REVERSE_SUBTRACT) + static Require _req(EXT_blend_subtract); } void Blend::bind() const @@ -38,7 +33,7 @@ void Blend::bind() const if(set_current(this)) { glEnable(GL_BLEND); - if(glBlendEquation) + if(EXT_blend_minmax) glBlendEquation(eq); glBlendFunc(src_factor, dst_factor); } @@ -56,5 +51,17 @@ const Blend &Blend::alpha() return blend; } +const Blend &Blend::additive() +{ + static Blend blend(ONE, ONE); + return blend; +} + +const Blend &Blend::additive_alpha() +{ + static Blend blend(SRC_ALPHA, ONE); + return blend; +} + } // namespace GL } // namespace Msp