From 1c909afe3998778e4cc045c9ab733e8afbf7c25b Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Wed, 2 May 2007 21:24:47 +0000 Subject: svn merge -r 60342:61148 svn+ssh://svn/svn/linden/branches/maintenance into release --- indra/llrender/llimagegl.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'indra/llrender/llimagegl.cpp') diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index a36dfd2269..0ec161b232 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -109,19 +109,27 @@ void LLImageGL::bindExternalTexture(LLGLuint gl_name, S32 stage, LLGLenum bind_t // static void LLImageGL::unbindTexture(S32 stage, LLGLenum bind_target) { - glActiveTextureARB(GL_TEXTURE0_ARB + stage); - glClientActiveTextureARB(GL_TEXTURE0_ARB + stage); - glBindTexture(bind_target, 0); - sCurrentBoundTextures[stage] = 0; + // LLGLSLShader can return -1 + if (stage >= 0) + { + glActiveTextureARB(GL_TEXTURE0_ARB + stage); + glClientActiveTextureARB(GL_TEXTURE0_ARB + stage); + glBindTexture(bind_target, 0); + sCurrentBoundTextures[stage] = 0; + } } // static (duplicated for speed and to avoid GL_TEXTURE_2D default argument which requires GL header dependency) void LLImageGL::unbindTexture(S32 stage) { - glActiveTextureARB(GL_TEXTURE0_ARB + stage); - glClientActiveTextureARB(GL_TEXTURE0_ARB + stage); - glBindTexture(GL_TEXTURE_2D, 0); - sCurrentBoundTextures[stage] = 0; + // LLGLSLShader can return -1 + if (stage >= 0) + { + glActiveTextureARB(GL_TEXTURE0_ARB + stage); + glClientActiveTextureARB(GL_TEXTURE0_ARB + stage); + glBindTexture(GL_TEXTURE_2D, 0); + sCurrentBoundTextures[stage] = 0; + } } // static -- cgit v1.2.3