Permalink
Browse files

Merge pull request #15 from pigucatalin/master

Contains fix for issue #13, the error when checking if WebGL is supported
  • Loading branch information...
2 parents aa10c07 + e42ceb2 commit 977f647f8b91be57a9fe36b78556ff744eaed295 @oslego oslego committed Sep 29, 2012
Showing with 19 additions and 3 deletions.
  1. +19 −3 lib/application.js
View
@@ -175,9 +175,25 @@
},
checkWebGLSupport: function(property, value) {
- var canvas = document.createElement('canvas');
- context = canvas.getContext("experimental-webgl");
- return !!context;
+ var isCanvasSupported = true;
+ var isWebGlSupported = true;
+ try{
+ var canvas = document.createElement('canvas');
+ }
+ catch(err){
+ isCanvasSupported = false;
+ }
+
+ try{
+ var context = canvas.getContext("experimental-webgl");
+ }
+ catch(err){
+ isWebGlSupported = false;
+ }
+ if (!(isCanvasSupported && isWebGlSupported)){
+ return null;
+ }
+ return !!context;
},
checkFeatures: function() {

0 comments on commit 977f647

Please sign in to comment.