-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathindex.html
38 lines (35 loc) · 1.14 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<canvas id="glCanvas" width="640" height="480">Your browser doesn't appear to support the <code><canvas></code> element.</canvas>
<script id="shader-fs" type="x-shader/x-fragment">
void main(void) {
gl_FragColor = vec4(0.0, 1.0, 1.0, 1.0);
}
</script>
<script id="shader-vs" type="x-shader/x-vertex">
attribute vec3 aVertexPosition;
uniform mat4 uMVMatrix;
uniform mat4 uPMatrix;
void main(void) {
gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);
}
</script>
<script>
var canvas = document.getElementById('glCanvas');
var vertexShader = document.getElementById('shader-vs');
var fragmentShader = document.getElementById('shader-fs');
const Renderer = require('./renderer.js');
var renderer = new Renderer({
'canvasElement' : canvas,
'vertexShader' : vertexShader.text,
'fragmentShader' : fragmentShader.text,
});
renderer.render();
</script>
</body>
</html>