blob: c005c003d7dc491d86822cc83a5952975094ba07 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
// 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;
}
if (ctx === undefined) {
Modernizr.webgl = new Boolean(false);
}
else {
Modernizr.webgl = new Boolean(true);
}
for (var i = -1, len = exts.length; ++i < len; ){
Modernizr.webgl[exts[i]] = true;
}
// hack for addressing modernizr testsuite failures. sorry.
if (window.TEST && TEST.audvid){
TEST.audvid.push('webgl');
}
canvas = undefined;
})();
|