diff --git a/OpenRA.Platforms.Default/OpenGL.cs b/OpenRA.Platforms.Default/OpenGL.cs index b3cf3dc251..9caddfc6e0 100644 --- a/OpenRA.Platforms.Default/OpenGL.cs +++ b/OpenRA.Platforms.Default/OpenGL.cs @@ -72,6 +72,7 @@ namespace OpenRA.Platforms.Default // Depth buffer public const int GL_DEPTH_COMPONENT = 0x1902; + public const int GL_LEQUAL = 0x0203; // BlendingFactorDest public const int GL_ZERO = 0; @@ -276,6 +277,9 @@ namespace OpenRA.Platforms.Default public delegate void BlendFunc(int sfactor, int dfactor); public static BlendFunc glBlendFunc { get; private set; } + public delegate void DepthFunc(int func); + public static DepthFunc glDepthFunc { get; private set; } + public delegate void Scissor(int x, int y, int width, int height); public static Scissor glScissor { get; private set; } @@ -418,6 +422,7 @@ namespace OpenRA.Platforms.Default glDisable = Bind("glDisable"); glBlendEquation = Bind("glBlendEquation"); glBlendFunc = Bind("glBlendFunc"); + glDepthFunc = Bind("glDepthFunc"); glScissor = Bind("glScissor"); glPushClientAttrib = Bind("glPushClientAttrib"); glPopClientAttrib = Bind("glPopClientAttrib"); diff --git a/OpenRA.Platforms.Default/Sdl2GraphicsDevice.cs b/OpenRA.Platforms.Default/Sdl2GraphicsDevice.cs index 98687ae96b..f5356eebe8 100644 --- a/OpenRA.Platforms.Default/Sdl2GraphicsDevice.cs +++ b/OpenRA.Platforms.Default/Sdl2GraphicsDevice.cs @@ -224,6 +224,8 @@ namespace OpenRA.Platforms.Default OpenGL.CheckGLError(); OpenGL.glEnable(OpenGL.GL_DEPTH_TEST); OpenGL.CheckGLError(); + OpenGL.glDepthFunc(OpenGL.GL_LEQUAL); + OpenGL.CheckGLError(); } public void DisableDepthBuffer()