diff --git a/src/core/renderers/webgl/shaders/Shader.js b/src/core/renderers/webgl/shaders/Shader.js index c5572fb..401bbba 100644 --- a/src/core/renderers/webgl/shaders/Shader.js +++ b/src/core/renderers/webgl/shaders/Shader.js @@ -430,7 +430,7 @@ } // bind the texture - gl.bindTexture(gl.TEXTURE_2D, uniform.value.baseTexture._glTextures[gl.id]); + gl.bindTexture(gl.TEXTURE_2D, texture); // set uniform to texture index gl.uniform1i(uniform._location, this.textureCount); diff --git a/src/core/renderers/webgl/shaders/Shader.js b/src/core/renderers/webgl/shaders/Shader.js index c5572fb..401bbba 100644 --- a/src/core/renderers/webgl/shaders/Shader.js +++ b/src/core/renderers/webgl/shaders/Shader.js @@ -430,7 +430,7 @@ } // bind the texture - gl.bindTexture(gl.TEXTURE_2D, uniform.value.baseTexture._glTextures[gl.id]); + gl.bindTexture(gl.TEXTURE_2D, texture); // set uniform to texture index gl.uniform1i(uniform._location, this.textureCount); diff --git a/src/core/sprites/webgl/SpriteRenderer.js b/src/core/sprites/webgl/SpriteRenderer.js index ebdfe3c..9c51a5a 100644 --- a/src/core/sprites/webgl/SpriteRenderer.js +++ b/src/core/sprites/webgl/SpriteRenderer.js @@ -404,6 +404,10 @@ //Make this a little more dynamic / intelligent! shader.syncUniforms(); + //TODO investigate some kind of texture state managment?? + // need to make sure this texture is the active one for all the batch swaps.. + gl.activeTexture(gl.TEXTURE0); + // both thease only need to be set if they are changing.. // set the projection //gl.uniformMatrix3fv(shader.uniforms.projectionMatrix._location, false, this.renderer.currentRenderTarget.projectionMatrix.toArray(true)); @@ -464,7 +468,7 @@ var gl = this.renderer.gl; // bind the main texture - gl.activeTexture(gl.TEXTURE0); + // bind the buffers gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer);