-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathasteroids.html
81 lines (76 loc) · 2.46 KB
/
asteroids.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Asteroids in webgl</title>
<script id="vertex-shader" type="x-shader/x-vertex">
#version 300 es
precision mediump float;
in vec3 aPosition;
in vec3 aColor;
out vec3 vColor;
uniform mat4 tMatrix;
uniform mat4 vMatrix;
uniform mat4 pMatrix;
uniform float pSize;
void main()
{
vColor = aColor;
vec4 position = pMatrix * vMatrix * tMatrix * vec4(aPosition, 1);
gl_Position = position;
gl_PointSize = pSize;
}
</script>
<script id="fragment-shader" type="x-shader/x-fragment">
#version 300 es
precision mediump float;
out vec4 fColor;
in vec3 vColor;
void main()
{
fColor = vec4(vColor, 1.0 );
}
</script>
<script type="text/javascript" src="Common/initShaders.js"></script>
<script type="text/javascript" src="Common/MV.js"></script>
<script type="text/javascript" src="physics/physics.js"></script>
<script type="text/javascript" src="geometry/shapes.js"></script>
<script type="text/javascript" src="UI/uiElements.js"></script>
<script type="text/javascript" src="geometry/transformations.js"></script>
<script type="text/javascript" src="animation/animation.js"></script>
<script type="text/javascript" src="Camera/camera.js"></script>
<script type="text/javascript" src="IO/files.js"></script>
<script type="text/javascript" src="asteroids.js"></script>
</head>
<style>
body {
background-image: url('space_background.jpg');
}
canvas {
padding-left: 0;
padding-right: 0;
margin-left: auto;
margin-right: auto;
display: block;
width: 512px;
border:5px solid #ffffff;
}
h2 {
color: #ffffff;
}
p {
color: #ffffff;
}
div {
text-align: center;
}
</style>
<body>
<canvas id="gl-canvas" width="500" height="500">>
Oops ... your browser doesn't support the HTML5 canvas element
</canvas>
<div id="container"></div>
<br>
</body>
</html>