Index: code/renderer/tr_local.h =================================================================== --- code/renderer/tr_local.h (revision 1737) +++ code/renderer/tr_local.h (working copy) @@ -1096,6 +1096,8 @@ extern cvar_t *r_showSmp; extern cvar_t *r_skipBackEnd; +extern cvar_t *r_hardwareEffects; + extern cvar_t *r_stereoEnabled; extern cvar_t *r_anaglyphMode; @@ -1522,6 +1524,7 @@ void RB_DeformTessGeometry( void ); void RB_CalcEnvironmentTexCoords( float *dstTexCoords ); +void RB_GLCalcEnvironmentTexCoords( void ); void RB_CalcFogTexCoords( float *dstTexCoords ); void RB_CalcScrollTexCoords( const float scroll[2], float *dstTexCoords ); void RB_CalcRotateTexCoords( float rotSpeed, float *dstTexCoords ); Index: code/renderer/tr_init.c =================================================================== --- code/renderer/tr_init.c (revision 1737) +++ code/renderer/tr_init.c (working copy) @@ -134,6 +134,8 @@ cvar_t *r_subdivisions; cvar_t *r_lodCurveError; +cvar_t *r_hardwareEffects; + cvar_t *r_fullscreen; cvar_t *r_noborder; @@ -918,6 +920,7 @@ r_vertexLight = ri.Cvar_Get( "r_vertexLight", "0", CVAR_ARCHIVE | CVAR_LATCH ); r_uiFullScreen = ri.Cvar_Get( "r_uifullscreen", "0", 0); r_subdivisions = ri.Cvar_Get ("r_subdivisions", "4", CVAR_ARCHIVE | CVAR_LATCH); + r_hardwareEffects = ri.Cvar_Get ("r_hardwareEffects", "0", CVAR_ARCHIVE | CVAR_LATCH); r_smp = ri.Cvar_Get( "r_smp", "0", CVAR_ARCHIVE | CVAR_LATCH); r_stereoEnabled = ri.Cvar_Get( "r_stereoEnabled", "0", CVAR_ARCHIVE | CVAR_LATCH); r_ignoreFastPath = ri.Cvar_Get( "r_ignoreFastPath", "1", CVAR_ARCHIVE | CVAR_LATCH ); Index: code/renderer/tr_shade_calc.c =================================================================== --- code/renderer/tr_shade_calc.c (revision 1737) +++ code/renderer/tr_shade_calc.c (working copy) @@ -915,6 +915,15 @@ } /* +** RB_GLCalcEnvironmentTexCoords +*/ +void RB_GLCalcEnvironmentTexCoords() +{ + qglTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); + qglTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); +} + +/* ** RB_CalcTurbulentTexCoords */ void RB_CalcTurbulentTexCoords( const waveForm_t *wf, float *st ) Index: code/renderer/tr_shade.c =================================================================== --- code/renderer/tr_shade.c (revision 1737) +++ code/renderer/tr_shade.c (working copy) @@ -1015,7 +1015,11 @@ RB_CalcFogTexCoords( ( float * ) tess.svars.texcoords[b] ); break; case TCGEN_ENVIRONMENT_MAPPED: - RB_CalcEnvironmentTexCoords( ( float * ) tess.svars.texcoords[b] ); + if ( !r_hardwareEffects->integer ) { + RB_CalcEnvironmentTexCoords( ( float * ) tess.svars.texcoords[b] ); + } else { + RB_GLCalcEnvironmentTexCoords(); + } break; case TCGEN_BAD: return; @@ -1092,6 +1096,11 @@ ComputeColors( pStage ); ComputeTexCoords( pStage ); + if ( pStage->bundle[0].tcGen == TCGEN_ENVIRONMENT_MAPPED && r_hardwareEffects->integer ) + { + qglEnable(GL_TEXTURE_GEN_S); + qglEnable(GL_TEXTURE_GEN_T); + } if ( !setArraysOnce ) { @@ -1130,6 +1139,11 @@ // R_DrawElements( input->numIndexes, input->indexes ); } + if ( pStage->bundle[0].tcGen == TCGEN_ENVIRONMENT_MAPPED && r_hardwareEffects->integer ) + { + qglDisable(GL_TEXTURE_GEN_S); + qglDisable(GL_TEXTURE_GEN_T); + } // allow skipping out to show just lightmaps during development if ( r_lightmap->integer && ( pStage->bundle[0].isLightmap || pStage->bundle[1].isLightmap || pStage->bundle[0].vertexLightmap ) ) {