3 function parseArgs() {
\r
4 var query = window.location.search.substring(1);
\r
6 var split = query.split("&");
\r
9 for (var i = 0; i < split.length; i++) {
\r
10 var pair = split[i].split("=");
\r
14 if (pair.length >= 2) {
\r
15 eval("value = " + decodeURIComponent(pair[1]) + ";");
\r
25 function arg(key, defaultVal) {
\r
26 if (gArgs === null) {
\r
27 gArgs = parseArgs();
\r
30 if (!(key in gArgs))
\r
36 function initGL(canvas) {
\r
42 var withAA = arg("aa", false);
\r
43 var withAlpha = arg("alpha", false);
\r
44 var withDepth = arg("depth", false);
\r
45 var withPremult = arg("premult", false);
\r
46 var withPreserve = arg("preserve", false);
\r
47 var withStencil = arg("stencil", false);
\r
53 stencil: withStencil,
\r
55 premultipliedAlpha: withPremult,
\r
56 preserveDrawingBuffer: withPreserve,
\r
58 gl = canvas.getContext("webgl", argDict);
\r
64 function rAF(func) {
\r
65 var raf = window.requestAnimationFrame;
\r
69 var MAX_WAIT_FOR_COMPOSITE_DELAY_MS = 500;
\r
71 function waitForComposite(func) {
\r
73 var doneFunc = function () {
\r
81 setTimeout(doneFunc, MAX_WAIT_FOR_COMPOSITE_DELAY_MS);
\r