From ce76a7406c2d311367ce4cee39ee291adc51d731 Mon Sep 17 00:00:00 2001 From: Andrew Wason Date: Thu, 25 Aug 2011 16:15:02 -0400 Subject: [PATCH] Need to set correct slot as gl.activeTexture in setTexture Fixes lightMap bug https://github.com/mrdoob/three.js/issues/458 --- src/renderers/WebGLRenderer.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index ab5191806e..4241225c50 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -4842,6 +4842,7 @@ THREE.WebGLRenderer = function ( parameters ) { } + _gl.activeTexture( _gl.TEXTURE0 + slot ); _gl.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture ); if ( texture.image.data ) { @@ -4856,10 +4857,11 @@ THREE.WebGLRenderer = function ( parameters ) { setTextureParameters( _gl.TEXTURE_2D, texture, texture.image ); - _gl.bindTexture( _gl.TEXTURE_2D, null ); - texture.needsUpdate = false; + } else { + _gl.activeTexture( _gl.TEXTURE0 + slot ); + _gl.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture ); } /* @@ -4890,10 +4892,6 @@ THREE.WebGLRenderer = function ( parameters ) { } */ - _gl.activeTexture( _gl.TEXTURE0 + slot ); - _gl.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture ); - - }; function setCubeTexture( texture, slot ) { -- GitLab