-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
55 lines (41 loc) · 1.8 KB
/
index.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
<html>
<head>
<title>Figures</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<script src="../libs/gl-matrix/gl-matrix.js"></script>
<script src="../libs/jquery-3.4.1/jquery-3.4.1.min.js"></script>
<script src=figures.js></script>
<script type="text/javascript">
// Jquery that detects the state of rediness. Code inside the function will only run once the page DOM is ready for Javascript code to execute.
$(document).ready(
function() {
let canvas = document.getElementById("webglcanvas");
let gl = initWebGL(canvas);
initGL(gl, canvas);
initViewport(gl, canvas);
initShader(gl);
let square = createSquare(gl);
let triangle = createTriangle(gl);
let diamond = createDiamond(gl);
let pacman = createPacman(gl);
mat4.identity(modelViewMatrix);
mat4.translate(modelViewMatrix, modelViewMatrix, [-1.0, 0.0, -3.333]);
draw(gl, square);
mat4.identity(modelViewMatrix);
mat4.translate(modelViewMatrix, modelViewMatrix, [1, 0.0, -3.333]);
draw(gl, triangle);
mat4.identity(modelViewMatrix);
mat4.translate(modelViewMatrix, modelViewMatrix, [-1.0, -0.75, -3.333])
draw(gl, diamond);
mat4.identity(modelViewMatrix);
mat4.translate(modelViewMatrix, modelViewMatrix, [1.0, -0.75, -3.333])
draw(gl, pacman);
}
);
</script>
</head>
<!-- All WebGL rendering takes place in a context. This structure is provided in the HTML5 Canvas element. -->
<body>
<canvas id="webglcanvas" style="border: none;" width="800px" height="600px" ></canvas>
</body>
</html>