From 95f9d55d45523b2b1754ff1e8f88f961fe200529 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Mon, 15 Oct 2018 00:43:40 +1100 Subject: [PATCH] Call glHint(GL_FOG_HINT, GL_NICEST) to try to get pixel fog activated in more cases. (Thanks csxns, addresses #547) --- ClassicalSharp/GraphicsAPI/OpenGLApi.cs | 10 ++++------ src/Graphics.c | 9 ++++++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ClassicalSharp/GraphicsAPI/OpenGLApi.cs b/ClassicalSharp/GraphicsAPI/OpenGLApi.cs index 185ddc684..976e97aa7 100644 --- a/ClassicalSharp/GraphicsAPI/OpenGLApi.cs +++ b/ClassicalSharp/GraphicsAPI/OpenGLApi.cs @@ -28,10 +28,9 @@ namespace ClassicalSharp.GraphicsAPI { public OpenGLApi(INativeWindow window) { glContext = Factory.Default.CreateGLContext(GraphicsMode.Default, window); GL.LoadEntryPoints(glContext); - - MinZNear = 0.1f; InitFields(); + MinZNear = 0.1f; int size; GL.GetIntegerv(GetPName.MaxTextureSize, &size); MaxTexWidth = size; MaxTexHeight = size; @@ -39,16 +38,15 @@ namespace ClassicalSharp.GraphicsAPI { #if !GL11 CustomMipmapsLevels = true; CheckVboSupport(); - #else - CustomMipmapsLevels = false; #endif base.InitCommon(); - setupBatchFuncCol4b = SetupVbPos3fCol4b; + setupBatchFuncCol4b = SetupVbPos3fCol4b; setupBatchFuncTex2fCol4b = SetupVbPos3fTex2fCol4b; - setupBatchFuncCol4b_Range = SetupVbPos3fCol4b_Range; + setupBatchFuncCol4b_Range = SetupVbPos3fCol4b_Range; setupBatchFuncTex2fCol4b_Range = SetupVbPos3fTex2fCol4b_Range; + GL.Hint(HintTarget.FogHint, HintMode.Nicest); GL.EnableClientState(ArrayCap.VertexArray); GL.EnableClientState(ArrayCap.ColorArray); } diff --git a/src/Graphics.c b/src/Graphics.c index 010d4e393..8359cf231 100644 --- a/src/Graphics.c +++ b/src/Graphics.c @@ -792,9 +792,11 @@ static void GL_CheckVboSupport(void) { #endif void Gfx_Init(void) { + struct GraphicsMode mode; + GraphicsMode_MakeDefault(&mode); + GLContext_Init(&mode); + Gfx_MinZNear = 0.1f; - struct GraphicsMode mode = GraphicsMode_MakeDefault(); - GLContext_Init(mode); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &Gfx_MaxTexWidth); Gfx_MaxTexHeight = Gfx_MaxTexWidth; @@ -802,8 +804,9 @@ void Gfx_Init(void) { Gfx_CustomMipmapsLevels = true; GL_CheckVboSupport(); #endif - GfxCommon_Init(); + + glHint(GL_FOG_HINT, GL_NICEST); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_COLOR_ARRAY); }