add a new BlendMode::Equation : ReverseSubtract

This commit is contained in:
Krozark 2015-08-13 14:40:20 +02:00 committed by Lukas Dürrenberger
parent 63fba49d96
commit 7ff9478061
3 changed files with 6 additions and 2 deletions

View File

@ -69,7 +69,8 @@ struct SFML_GRAPHICS_API BlendMode
enum Equation enum Equation
{ {
Add, ///< Pixel = Src * SrcFactor + Dst * DstFactor Add, ///< Pixel = Src * SrcFactor + Dst * DstFactor
Subtract ///< Pixel = Src * SrcFactor - Dst * DstFactor Subtract, ///< Pixel = Src * SrcFactor - Dst * DstFactor
ReverseSubtract ///< Pixel = Dst * DstFactor - Src * SrcFactor
}; };
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////

View File

@ -64,6 +64,7 @@
#define GLEXT_glBlendEquation glBlendEquationOES #define GLEXT_glBlendEquation glBlendEquationOES
#define GLEXT_GL_FUNC_ADD GL_FUNC_ADD_OES #define GLEXT_GL_FUNC_ADD GL_FUNC_ADD_OES
#define GLEXT_GL_FUNC_SUBTRACT GL_FUNC_SUBTRACT_OES #define GLEXT_GL_FUNC_SUBTRACT GL_FUNC_SUBTRACT_OES
#define GLEXT_GL_FUNC_REVERSE_SUBTRACT GL_FUNC_REVERSE_SUBTRACT_OES
// The following extensions are optional. // The following extensions are optional.
@ -142,6 +143,7 @@
// Core since 1.2 - EXT_blend_subtract // Core since 1.2 - EXT_blend_subtract
#define GLEXT_blend_subtract sfogl_ext_EXT_blend_subtract #define GLEXT_blend_subtract sfogl_ext_EXT_blend_subtract
#define GLEXT_GL_FUNC_SUBTRACT GL_FUNC_SUBTRACT_EXT #define GLEXT_GL_FUNC_SUBTRACT GL_FUNC_SUBTRACT_EXT
#define GLEXT_GL_FUNC_REVERSE_SUBTRACT GL_FUNC_REVERSE_SUBTRACT_EXT
// Core since 1.3 - ARB_multitexture // Core since 1.3 - ARB_multitexture
#define GLEXT_multitexture sfogl_ext_ARB_multitexture #define GLEXT_multitexture sfogl_ext_ARB_multitexture

View File

@ -67,6 +67,7 @@ namespace
{ {
case sf::BlendMode::Add: return GLEXT_GL_FUNC_ADD; case sf::BlendMode::Add: return GLEXT_GL_FUNC_ADD;
case sf::BlendMode::Subtract: return GLEXT_GL_FUNC_SUBTRACT; case sf::BlendMode::Subtract: return GLEXT_GL_FUNC_SUBTRACT;
case sf::BlendMode::ReverseSubtract: return GLEXT_GL_FUNC_REVERSE_SUBTRACT;
} }
sf::err() << "Invalid value for sf::BlendMode::Equation! Fallback to sf::BlendMode::Add." << std::endl; sf::err() << "Invalid value for sf::BlendMode::Equation! Fallback to sf::BlendMode::Add." << std::endl;