From e2321d816b03aa890b2fd320cc6caded2c2ead3a Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Thu, 26 Nov 2015 09:06:42 +0000 Subject: [PATCH] Fog: move setting of GL_FOG_MODE to GL_EXP2 to a new Fog_SetupState() function and call it in VID_Restart. Fixes bug where the fog mode was resetting to the default (GL_EXP) after a mode switch, causing fog to look different. This was only affecting SDL1 for me. git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1259 af15c1b1-3010-417e-b628-4374ebc0bcbd --- Quake/gl_fog.c | 12 ++++++++++++ Quake/gl_vidsdl.c | 1 + Quake/glquake.h | 1 + 3 files changed, 14 insertions(+) diff --git a/Quake/gl_fog.c b/Quake/gl_fog.c index a120aee5..e0e3996a 100644 --- a/Quake/gl_fog.c +++ b/Quake/gl_fog.c @@ -394,5 +394,17 @@ void Fog_Init (void) fog_green = DEFAULT_GRAY; fog_blue = DEFAULT_GRAY; + Fog_SetupState (); +} + +/* +============= +Fog_SetupState + +ericw -- moved from Fog_Init, state that needs to be setup when a new context is created +============= +*/ +void Fog_SetupState (void) +{ glFogi(GL_FOG_MODE, GL_EXP2); } diff --git a/Quake/gl_vidsdl.c b/Quake/gl_vidsdl.c index 050d538e..7e2fe738 100644 --- a/Quake/gl_vidsdl.c +++ b/Quake/gl_vidsdl.c @@ -760,6 +760,7 @@ static void VID_Restart (void) GL_BuildBModelVertexBuffer (); GLMesh_LoadVertexBuffers (); GL_SetupState (); + Fog_SetupState (); //warpimages needs to be recalculated TexMgr_RecalcWarpImageSize (); diff --git a/Quake/glquake.h b/Quake/glquake.h index c596fb52..a9df1e4a 100644 --- a/Quake/glquake.h +++ b/Quake/glquake.h @@ -313,6 +313,7 @@ void Fog_StopAdditive (void); void Fog_SetupFrame (void); void Fog_NewMap (void); void Fog_Init (void); +void Fog_SetupState (void); void R_NewGame (void);