-
Notifications
You must be signed in to change notification settings - Fork 4
/
webgl-maximums.html
81 lines (69 loc) · 2.15 KB
/
webgl-maximums.html
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<html>
<head>
<title>WebGL Maximums</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript">
// MAX_COMBINED_TEXTURE_IMAGE_UNITS long
// MAX_CUBE_MAP_TEXTURE_SIZE long
// MAX_FRAGMENT_UNIFORM_VECTORS long
// MAX_RENDERBUFFER_SIZE long
// MAX_TEXTURE_IMAGE_UNITS long
// MAX_TEXTURE_SIZE long
// MAX_VARYING_VECTORS long
// MAX_VERTEX_ATTRIBS long
// MAX_VERTEX_TEXTURE_IMAGE_UNITS long
// MAX_VERTEX_UNIFORM_VECTORS long
// MAX_VIEWPORT_DIMS Int32Array (with 2 elements)
var webgl_limits = [
["MAX_COMBINED_TEXTURE_IMAGE_UNITS", ""],
["MAX_CUBE_MAP_TEXTURE_SIZE", ""],
["MAX_FRAGMENT_UNIFORM_VECTORS", ""],
["MAX_RENDERBUFFER_SIZE", ""],
["MAX_TEXTURE_IMAGE_UNITS", ""],
["MAX_TEXTURE_SIZE", ""],
["MAX_VARYING_VECTORS", ""],
["MAX_VERTEX_ATTRIBS", ""],
["MAX_VERTEX_TEXTURE_IMAGE_UNITS", ""],
["MAX_VERTEX_UNIFORM_VECTORS", ""],
["MAX_VIEWPORT_DIMS", ""]
];
var gl;
function initGL(canvas) {
try {
gl = canvas.getContext("experimental-webgl");
gl.viewportWidth = canvas.width;
gl.viewportHeight = canvas.height;
} catch(e) {
}
if (!gl) {
alert("Could not initialise WebGL, sorry :-(");
}
}
function getWebGLMaximums() {
var i, j, limit, value, results, item;
results = document.getElementById("results");
for (i = 0; i < webgl_limits.length; i++) {
limit = webgl_limits[i];
value = gl.getParameter(gl[limit[0]]);
if (value instanceof Int32Array) {
limit[1] = value[0] + ', ' + value[1];
} else {
limit[1] = value;
}
item = document.createElement("li");
item.innerHTML = limit[0] + ': ' + limit[1];
results.appendChild(item);
}
};
function webGLStart() {
var canvas = document.getElementById("canvas");
initGL(canvas);
getWebGLMaximums();
}
</script>
<body onload="webGLStart();">
<ul id="results">
</ul>
<canvas id="canvas" style="border: none;" width="100" height="100"></canvas>
</body>
</html>