Skip to content

Commit

Permalink
Website: demo fixes (#1069)
Browse files Browse the repository at this point in the history
  • Loading branch information
1chandu committed Apr 17, 2019
1 parent 2d73cdc commit cbef3c6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
4 changes: 3 additions & 1 deletion examples/core/texture-3d/app.js
Expand Up @@ -158,7 +158,9 @@ export default class AppAnimationLoop extends AnimationLoop {
}

onFinalize({gl, cloud}) {
cloud.delete();
if (cloud) {
cloud.delete();
}
}

isSupported() {
Expand Down
3 changes: 1 addition & 2 deletions examples/core/transform/app.js
Expand Up @@ -239,8 +239,7 @@ export default class AppAnimationLoop extends AnimationLoop {
colorBuffer,
offsetBuffer,
renderModel,
transform,
isDemoSupported
transform
};
}
/* eslint-enable max-statements */
Expand Down
12 changes: 10 additions & 2 deletions modules/webgl/src/classes/texture.js
Expand Up @@ -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;

Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit cbef3c6

Please sign in to comment.