-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
webgl-extensions detection. exposed like an object: Modernizr.webgl.O…
…ES_standard_derivatives
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
|
||
// Grab the WebGL extensions currently supported and add to the Modernizr.webgl object | ||
// spec: www.khronos.org/registry/webgl/specs/latest/#5.13.14 | ||
|
||
// based on code from ilmari heikkinen | ||
// code.google.com/p/graphics-detect/source/browse/js/detect.js | ||
|
||
|
||
(function(){ | ||
|
||
if (!Modernizr.webgl) return; | ||
|
||
var canvas, ctx, exts; | ||
|
||
try { | ||
canvas = document.createElement('canvas'), | ||
ctx = canvas.getContext('webgl') || canvas.getContext('experimental-webgl'); | ||
exts = ctx.getSupportedExtensions(); | ||
} | ||
catch (e) { | ||
return; | ||
} | ||
|
||
Modernizr.webgl = new Boolean(true); | ||
|
||
for (var i = -1, len = exts.length; ++i < len; ){ | ||
Modernizr.webgl[exts[i]] = true; | ||
} | ||
|
||
canvas = undefined;; | ||
This comment has been minimized.
Sorry, something went wrong. |
||
})(); |
small typo here?