diff options
author | Zack Middleton <zturtleman@gmail.com> | 2014-09-29 00:35:03 -0500 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2015-03-17 11:38:47 +0000 |
commit | 502d5b81898df2420cdc3601c1cb6d711844eaa5 (patch) | |
tree | 9a47b5fa658286323be07e5d124a4c0e423f4af4 | |
parent | c1d82cb348c1a34224be58649760422ba7f43dd0 (diff) |
OpenGL2: Don't segfault if r_ext_multitexture is disabled
-rw-r--r-- | src/renderergl2/tr_backend.c | 5 | ||||
-rw-r--r-- | src/renderergl2/tr_shader.c | 6 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/renderergl2/tr_backend.c b/src/renderergl2/tr_backend.c index 964da39a..2ba52f69 100644 --- a/src/renderergl2/tr_backend.c +++ b/src/renderergl2/tr_backend.c @@ -78,6 +78,9 @@ void GL_SelectTexture( int unit ) if (!(unit >= 0 && unit <= 31)) ri.Error( ERR_DROP, "GL_SelectTexture: unit = %i", unit ); + if (!qglActiveTextureARB) + ri.Error( ERR_DROP, "GL_SelectTexture: multitexture disabled" ); + qglActiveTextureARB( GL_TEXTURE0_ARB + unit ); glState.currenttmu = unit; @@ -1654,7 +1657,7 @@ const void *RB_PostProcess(const void *data) 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; RB_ToneMap(srcFbo, srcBox, NULL, dstBox, autoExposure); diff --git a/src/renderergl2/tr_shader.c b/src/renderergl2/tr_shader.c index 867f0a47..689df052 100644 --- a/src/renderergl2/tr_shader.c +++ b/src/renderergl2/tr_shader.c @@ -2371,7 +2371,7 @@ static void CollapseStagesToLightall(shaderStage_t *diffuse, } -static qboolean CollapseStagesToGLSL(void) +static int CollapseStagesToGLSL(void) { int i, j, numStages; qboolean skip = qfalse; @@ -3108,7 +3108,9 @@ static shader_t *FinishShader( void ) { // // look for multitexture potential // - stage = CollapseStagesToGLSL(); + if ( qglActiveTextureARB ) { + stage = CollapseStagesToGLSL(); + } if ( shader.lightmapIndex >= 0 && !hasLightmapStage ) { if (vertexLightmap) { |