-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscript.js
More file actions
29 lines (22 loc) · 786 Bytes
/
Copy pathscript.js
File metadata and controls
29 lines (22 loc) · 786 Bytes
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
// reference to canvas
var can = document.getElementById("full");
function resizeCanvas() {
can.style.width = window.innerWidth + "px";
// artifical delay so innerHeight is correct
setTimeout(function() {
can.style.height = window.innerHeight + "px";
}, 0);
};
// Webkit/Blink will fire this on load, but Gecko doesn't.
window.onresize = resizeCanvas;
// So we fire it manually...
resizeCanvas();
gl = can.getContext('webgl') || can.getContext('experimental-webgl');
// Set clear color to black, fully opaque
gl.clearColor(0.0, 0.0, 0.0, 0.0);
// Enable depth testing
gl.enable(gl.DEPTH_TEST);
// Near things obscure far things
gl.depthFunc(gl.LEQUAL);
// Clear the color as well as the depth buffer.
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);