diff --git a/OpenRA.FileFormats/Graphics/IGraphicsDevice.cs b/OpenRA.FileFormats/Graphics/IGraphicsDevice.cs index 9be4681fc8..efd2bb6cfb 100755 --- a/OpenRA.FileFormats/Graphics/IGraphicsDevice.cs +++ b/OpenRA.FileFormats/Graphics/IGraphicsDevice.cs @@ -32,7 +32,7 @@ namespace OpenRA.FileFormats.Graphics IGraphicsDevice Create( Size size, WindowMode windowMode ); } - public enum BlendMode { None, Alpha, Additive } + public enum BlendMode { None, Alpha, Additive, Subtractive } public interface IGraphicsDevice { diff --git a/OpenRA.Renderer.SdlCommon/SdlGraphics.cs b/OpenRA.Renderer.SdlCommon/SdlGraphics.cs index f8ab2ecde7..8c8de209e3 100644 --- a/OpenRA.Renderer.SdlCommon/SdlGraphics.cs +++ b/OpenRA.Renderer.SdlCommon/SdlGraphics.cs @@ -154,6 +154,9 @@ namespace OpenRA.Renderer.SdlCommon public void SetBlendMode(BlendMode mode) { + Gl.glBlendEquation(Gl.GL_FUNC_ADD); + ErrorHandler.CheckGlError(); + switch (mode) { case BlendMode.None: @@ -169,6 +172,13 @@ namespace OpenRA.Renderer.SdlCommon ErrorHandler.CheckGlError(); Gl.glBlendFunc(Gl.GL_ONE, Gl.GL_ONE); break; + case BlendMode.Subtractive: + Gl.glEnable(Gl.GL_BLEND); + ErrorHandler.CheckGlError(); + Gl.glBlendFunc(Gl.GL_ONE, Gl.GL_ONE); + ErrorHandler.CheckGlError(); + Gl.glBlendEquation(Gl.GL_FUNC_REVERSE_SUBTRACT); + break; } ErrorHandler.CheckGlError(); }