diff --git a/examples/core/texture-3d/app.js b/examples/core/texture-3d/app.js index ce09602a22..d4a5131fa5 100644 --- a/examples/core/texture-3d/app.js +++ b/examples/core/texture-3d/app.js @@ -158,7 +158,9 @@ export default class AppAnimationLoop extends AnimationLoop { } onFinalize({gl, cloud}) { - cloud.delete(); + if (cloud) { + cloud.delete(); + } } isSupported() { diff --git a/examples/core/transform/app.js b/examples/core/transform/app.js index 25ebef872f..29ec7df04c 100644 --- a/examples/core/transform/app.js +++ b/examples/core/transform/app.js @@ -239,8 +239,7 @@ export default class AppAnimationLoop extends AnimationLoop { colorBuffer, offsetBuffer, renderModel, - transform, - isDemoSupported + transform }; } /* eslint-enable max-statements */ diff --git a/modules/webgl/src/classes/texture.js b/modules/webgl/src/classes/texture.js index 349a7218f6..6ad602e789 100644 --- a/modules/webgl/src/classes/texture.js +++ b/modules/webgl/src/classes/texture.js @@ -147,7 +147,7 @@ export default class Texture extends Resource { }; const glSettings = Object.assign({}, DEFAULT_TEXTURE_SETTINGS, pixelStore); - if (this._isNPOT() && mipmaps) { + if (mipmaps && this._isNPOT()) { log.warn(`texture: ${this} is Non-Power-Of-Two, disabling mipmaping`)(); mipmaps = false; @@ -696,7 +696,15 @@ export default class Texture extends Resource { } _isNPOT() { - return !isWebGL2(this.gl) && (!isPowerOfTwo(this.width) || !isPowerOfTwo(this.height)); + if (isWebGL2(this.gl)) { + // NPOT restriction is only for WebGL1 + return false; + } + // Width and height not available, consider it is not NPOT texture + if (!this.width || !this.height) { + return false; + } + return !isPowerOfTwo(this.width) || !isPowerOfTwo(this.height); } // Update default settings which are not supported by NPOT textures.