@@ -362,12 +362,12 @@ PIXI.WebGLSpriteBatch.prototype.renderTilingSprite = function (sprite) {
362362 var texture = sprite . tilingTexture ;
363363 var baseTexture = texture . baseTexture ;
364364 var gl = this . gl ;
365-
366- if ( this . textureArray [ baseTexture . textureIndex ] != baseTexture ) {
367- gl . activeTexture ( gl . TEXTURE0 + baseTexture . textureIndex ) ;
368- gl . bindTexture ( gl . TEXTURE_2D , baseTexture . _glTextures [ gl . id ] ) ;
369- this . textureArray [ baseTexture . textureIndex ] = baseTexture ;
365+ var textureIndex = sprite . texture . baseTexture . textureIndex ;
366+ if ( this . textureArray [ textureIndex ] != baseTexture ) {
370367 this . flush ( ) ;
368+ gl . activeTexture ( gl . TEXTURE0 + textureIndex ) ;
369+ gl . bindTexture ( gl . TEXTURE_2D , baseTexture . _glTextures [ gl . id ] ) ;
370+ this . textureArray [ textureIndex ] = baseTexture ;
371371 }
372372
373373 // check texture..
@@ -444,7 +444,6 @@ PIXI.WebGLSpriteBatch.prototype.renderTilingSprite = function (sprite) {
444444 var d = wt . d / resolution ;
445445 var tx = wt . tx ;
446446 var ty = wt . ty ;
447- var textureIndex = texture . baseTexture . textureIndex ;
448447 // xy
449448 positions [ i ++ ] = a * w1 + c * h1 + tx ;
450449 positions [ i ++ ] = d * h1 + b * w1 + ty ;
@@ -651,9 +650,6 @@ PIXI.WebGLSpriteBatch.prototype.renderBatch = function (texture, size, startInde
651650 // If updateTexture returns false then we cannot render it, so bail out now
652651 return ;
653652 }
654- } else {
655- gl . activeTexture ( gl . TEXTURE0 + texture . textureIndex ) ;
656- gl . bindTexture ( gl . TEXTURE_2D , texture . _glTextures [ gl . id ] ) ;
657653 }
658654 gl . drawElements ( gl . TRIANGLES , size * 6 , gl . UNSIGNED_SHORT , startIndex * 6 * 2 ) ;
659655 // increment the draw count
0 commit comments