forked from imindseye/WebGL-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcode00.html
More file actions
50 lines (36 loc) · 1.06 KB
/
code00.html
File metadata and controls
50 lines (36 loc) · 1.06 KB
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
<!DOCTYPE html>
<html>
<head>
<title>hwshen WebGL — Simple Canvas </title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript">
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 drawScene() {
gl.viewport(0, 0, gl.viewportWidth, gl.viewportHeight);
gl.clear(gl.COLOR_BUFFER_BIT); // | gl.DEPTH_BUFFER_BIT);
// 0x0001 | 0x0002
}
function webGLStart() {
var canvas = document.getElementById("code00-canvas");
initGL(canvas);
gl.clearColor(1.0, 1.0, 0.0, 1.0); // yellow
drawScene();
}
</script>
</head>
<body onload="webGLStart();">
<canvas id="code00-canvas" style="border: none;" width="700" height="500"></canvas>
<br/>
</body>
</html>