Permalink
Browse files

Fix exception on systems without anisotropic texture filtering.

The problem was that getExtension returns null if the extension is not
found, and the code that followed was only checking it against undefined.
  • Loading branch information...
kring committed Dec 4, 2012
1 parent 7d2fe43 commit 50a213a51d58a60fda987a1e53d07625cb09d1f6
Showing with 4 additions and 3 deletions.
  1. +4 −3 Source/Renderer/Context.js
@@ -259,12 +259,13 @@ define([
this._maximumViewportDimensions = gl.getParameter(gl.MAX_VIEWPORT_DIMS);
// Query and initialize extensions
- this._standardDerivatives = gl.getExtension('OES_standard_derivatives');
- this._depthTexture = gl.getExtension('WEBKIT_WEBGL_depth_texture') || gl.getExtension('MOZ_WEBGL_depth_texture');
+ this._standardDerivatives = gl.getExtension('OES_standard_derivatives') || undefined;
+ this._depthTexture = gl.getExtension('WEBKIT_WEBGL_depth_texture') || gl.getExtension('MOZ_WEBGL_depth_texture') || undefined;
var textureFilterAnisotropic = allowTextureFilterAnisotropic ?
gl.getExtension('EXT_texture_filter_anisotropic') ||
gl.getExtension('WEBKIT_EXT_texture_filter_anisotropic') ||
- gl.getExtension('MOZ_EXT_texture_filter_anisotropic') : undefined;
+ gl.getExtension('MOZ_EXT_texture_filter_anisotropic') ||
+ undefined : undefined;
this._textureFilterAnisotropic = textureFilterAnisotropic;
this._maximumTextureFilterAnisotropy = (typeof textureFilterAnisotropic !== 'undefined') ? gl.getParameter(textureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 1.0;

1 comment on commit 50a213a

@pjcozzi

This comment has been minimized.

Show comment
Hide comment
@pjcozzi

pjcozzi Dec 4, 2012

Member

Good catch. Thanks.

Member

pjcozzi commented on 50a213a Dec 4, 2012

Good catch. Thanks.

Please sign in to comment.