-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
45 lines (38 loc) · 1.34 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
<! doctype html>
<html>
<head>
<title>Vertex Wave</title>
<meta charset ="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1"> <!-- Use Chrome Frame in IE -->
</head>
<body>
<div id="message" style="position:absolute;top:100px"></div> <!-- Pixel offset to avoid FPS counter -->
<canvas id="canvas" style="border: none;" width="1024" height="768" tabindex="1"></canvas>
<script id="vs" type="x-shader/x-vertex">
attribute vec2 position;
varying vec3 color;
uniform mat4 u_modelViewPerspective;
uniform float u_time;
void main(void)
{
//float height = 0.0;
float s_contrib = sin(position.x*2.0*3.14159 + u_time);
float t_contrib = cos(position.y*2.0*3.14159 + u_time);
float height = s_contrib*t_contrib;
color = mix(vec3(s_contrib, t_contrib,height), vec3(1.0, 1.0, 1.0), height);
gl_Position = u_modelViewPerspective * vec4(vec3(position, height), 1.0);
}
</script>
<script id="fs" type="x-shader/x-fragment">
precision mediump float;
varying vec3 color;
void main(void)
{
gl_FragColor = vec4(color, 1.0);
}
</script>
<script src ="gl-matrix.js" type ="text/javascript"></script>
<script src ="webglUtility.js" type ="text/javascript"></script>
<script src ="index.js" type ="text/javascript"></script>
</body>
</html>