diff options
author | Brian Paul <[email protected]> | 2004-10-13 15:54:48 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2004-10-13 15:54:48 +0000 |
commit | dfe508ca7af1a6d1099cd65e257512ed1e17d893 (patch) | |
tree | 1393d22cefdabb68c1b35bb24c108edd76b8abf9 /src/mesa/swrast/s_context.c | |
parent | 886df0926fe6b3d8f82cff62747abfdb95540aa0 (diff) |
Fix minor fog / fragment program state bug.
Don't add diffuse and specular colors when using fragment program.
Diffstat (limited to 'src/mesa/swrast/s_context.c')
-rw-r--r-- | src/mesa/swrast/s_context.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index 87d4bf8cdf3..e9755e91997 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -196,19 +196,22 @@ _swrast_update_fog_state( GLcontext *ctx ) CLAMPED_FLOAT_TO_CHAN(swrast->_FogColor[GCOMP], ctx->Fog.Color[GCOMP]); CLAMPED_FLOAT_TO_CHAN(swrast->_FogColor[BCOMP], ctx->Fog.Color[BCOMP]); - /* determine if fog is needed */ + /* determine if fog is needed, and if so, which fog mode */ swrast->_FogEnabled = GL_FALSE; - if (ctx->Fog.Enabled) { - swrast->_FogEnabled = GL_TRUE; - } - else if (ctx->FragmentProgram._Enabled && - ctx->FragmentProgram.Current->Base.Target == GL_FRAGMENT_PROGRAM_ARB) { - const struct fragment_program *p; - p = (struct fragment_program *) ctx->FragmentProgram.Current; - if (p->FogOption != GL_NONE) { - swrast->_FogEnabled = GL_TRUE; + if (ctx->FragmentProgram._Enabled) { + if (ctx->FragmentProgram.Current->Base.Target==GL_FRAGMENT_PROGRAM_ARB) { + const struct fragment_program *p + = (struct fragment_program *) ctx->FragmentProgram.Current; + if (p->FogOption != GL_NONE) { + swrast->_FogEnabled = GL_TRUE; + swrast->_FogMode = p->FogOption; + } } } + else if (ctx->Fog.Enabled) { + swrast->_FogEnabled = GL_TRUE; + swrast->_FogMode = ctx->Fog.Mode; + } } @@ -480,7 +483,7 @@ _swrast_validate_derived( GLcontext *ctx ) if (swrast->NewState & _SWRAST_NEW_TEXTURE_ENV_MODE) _swrast_update_texture_env( ctx ); - if (swrast->NewState & _NEW_FOG) + if (swrast->NewState & (_NEW_FOG | _NEW_PROGRAM)) _swrast_update_fog_state( ctx ); if (swrast->NewState & _NEW_PROGRAM) |