diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index b781f05..cb267a8 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -300,7 +300,7 @@ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, texture.scaleMode === CONST.scaleModes.LINEAR ? gl.LINEAR : gl.NEAREST); - if (texture.mipmap && utils.isPowerOfTwo(texture.width, texture.height)) + if (texture.mipmap && texture.isPowerOfTwo) { gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, texture.scaleMode === CONST.scaleModes.LINEAR ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST); gl.generateMipmap(gl.TEXTURE_2D); @@ -310,7 +310,7 @@ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, texture.scaleMode === CONST.scaleModes.LINEAR ? gl.LINEAR : gl.NEAREST); } - if (!texture._powerOf2) + if (!texture.isPowerOfTwo) { gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index b781f05..cb267a8 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -300,7 +300,7 @@ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, texture.scaleMode === CONST.scaleModes.LINEAR ? gl.LINEAR : gl.NEAREST); - if (texture.mipmap && utils.isPowerOfTwo(texture.width, texture.height)) + if (texture.mipmap && texture.isPowerOfTwo) { gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, texture.scaleMode === CONST.scaleModes.LINEAR ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST); gl.generateMipmap(gl.TEXTURE_2D); @@ -310,7 +310,7 @@ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, texture.scaleMode === CONST.scaleModes.LINEAR ? gl.LINEAR : gl.NEAREST); } - if (!texture._powerOf2) + if (!texture.isPowerOfTwo) { gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index fe0533c..6f711a7 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -94,7 +94,7 @@ * @member {boolean} * @private */ - this._powerOf2 = false; + this.isPowerOfTwo = false; // used for webGL @@ -277,6 +277,8 @@ this.width = this.source.naturalWidth || this.source.width; this.height = this.source.naturalHeight || this.source.height; + this.isPowerOfTwo = utils.isPowerOfTwo(this.width, this.height); + this.update(); }; diff --git a/src/core/renderers/webgl/WebGLRenderer.js b/src/core/renderers/webgl/WebGLRenderer.js index b781f05..cb267a8 100644 --- a/src/core/renderers/webgl/WebGLRenderer.js +++ b/src/core/renderers/webgl/WebGLRenderer.js @@ -300,7 +300,7 @@ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, texture.scaleMode === CONST.scaleModes.LINEAR ? gl.LINEAR : gl.NEAREST); - if (texture.mipmap && utils.isPowerOfTwo(texture.width, texture.height)) + if (texture.mipmap && texture.isPowerOfTwo) { gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, texture.scaleMode === CONST.scaleModes.LINEAR ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST); gl.generateMipmap(gl.TEXTURE_2D); @@ -310,7 +310,7 @@ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, texture.scaleMode === CONST.scaleModes.LINEAR ? gl.LINEAR : gl.NEAREST); } - if (!texture._powerOf2) + if (!texture.isPowerOfTwo) { gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); diff --git a/src/core/textures/BaseTexture.js b/src/core/textures/BaseTexture.js index fe0533c..6f711a7 100644 --- a/src/core/textures/BaseTexture.js +++ b/src/core/textures/BaseTexture.js @@ -94,7 +94,7 @@ * @member {boolean} * @private */ - this._powerOf2 = false; + this.isPowerOfTwo = false; // used for webGL @@ -277,6 +277,8 @@ this.width = this.source.naturalWidth || this.source.width; this.height = this.source.naturalHeight || this.source.height; + this.isPowerOfTwo = utils.isPowerOfTwo(this.width, this.height); + this.update(); }; diff --git a/src/extras/TilingSprite.js b/src/extras/TilingSprite.js index 4c90363..03d693e 100644 --- a/src/extras/TilingSprite.js +++ b/src/extras/TilingSprite.js @@ -124,8 +124,6 @@ */ TilingSprite.prototype._renderWebGL = function (renderer) { - - if (!this.tilingTexture || this._refreshTexture) { this.generateTilingTexture(true); @@ -448,7 +446,6 @@ this.originalTexture = this.texture; this.texture = this.tilingTexture; - this.tilingTexture.baseTexture._powerOf2 = true; }; TilingSprite.prototype.destroy = function () {