OpenGL2: Don't segfault if r_ext_multitexture is disabled

This commit is contained in:
Zack Middleton 2014-09-29 00:35:03 -05:00
parent 0e5835a86e
commit 918eed9295
2 changed files with 8 additions and 3 deletions

View file

@ -77,6 +77,9 @@ void GL_SelectTexture( int unit )
if (!(unit >= 0 && unit <= 31)) if (!(unit >= 0 && unit <= 31))
ri.Error( ERR_DROP, "GL_SelectTexture: unit = %i", unit ); ri.Error( ERR_DROP, "GL_SelectTexture: unit = %i", unit );
if (!qglActiveTextureARB)
ri.Error( ERR_DROP, "GL_SelectTexture: multitexture disabled" );
qglActiveTextureARB( GL_TEXTURE0_ARB + unit ); qglActiveTextureARB( GL_TEXTURE0_ARB + unit );
glState.currenttmu = unit; glState.currenttmu = unit;
@ -1653,7 +1656,7 @@ const void *RB_PostProcess(const void *data)
if (srcFbo) if (srcFbo)
{ {
if (r_hdr->integer && (r_toneMap->integer || r_forceToneMap->integer)) if (r_hdr->integer && (r_toneMap->integer || r_forceToneMap->integer) && qglActiveTextureARB)
{ {
autoExposure = r_autoExposure->integer || r_forceAutoExposure->integer; autoExposure = r_autoExposure->integer || r_forceAutoExposure->integer;
RB_ToneMap(srcFbo, srcBox, NULL, dstBox, autoExposure); RB_ToneMap(srcFbo, srcBox, NULL, dstBox, autoExposure);

View file

@ -2370,7 +2370,7 @@ static void CollapseStagesToLightall(shaderStage_t *diffuse,
} }
static qboolean CollapseStagesToGLSL(void) static int CollapseStagesToGLSL(void)
{ {
int i, j, numStages; int i, j, numStages;
qboolean skip = qfalse; qboolean skip = qfalse;
@ -3107,7 +3107,9 @@ static shader_t *FinishShader( void ) {
// //
// look for multitexture potential // look for multitexture potential
// //
if ( qglActiveTextureARB ) {
stage = CollapseStagesToGLSL(); stage = CollapseStagesToGLSL();
}
if ( shader.lightmapIndex >= 0 && !hasLightmapStage ) { if ( shader.lightmapIndex >= 0 && !hasLightmapStage ) {
if (vertexLightmap) { if (vertexLightmap) {