Skip to content

Commit

Permalink
make WebGL detection a little more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
biasmv committed Jan 15, 2015
1 parent 2b91ceb commit 69e12b4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,14 @@ function isWebGLSupported(gl) {
return false;
}
if (gl === undefined) {
var canvas = document.createElement('canvas');
gl = canvas.getContext('experimental-webgl');
try {
var canvas = document.createElement("canvas");
return !! (window.WebGLRenderingContext &&
canvas.getContext("experimental-webgl"));
} catch(e) {
return false;
}
}
// force to bool
return !!gl;
}

Expand Down

0 comments on commit 69e12b4

Please sign in to comment.