forked from ou-sbselab/CSI4900-ComputerGraphics
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtextureSquare.html
executable file
·83 lines (66 loc) · 1.7 KB
/
textureSquare.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
82
83
<!DOCTYPE html>
<html>
<p> </p>
<div>
zNear .01<input id="zNearSlider" type="range"
min=".01" max="3" step="0.01" value="0.3" />
3
</div>
<div>
zFar 3<input id="zFarSlider" type="range"
min="3" max="50" step="1.0" value="3" />
50
</div>
<div>
fov 10<input id="fovSlider" type="range"
min="10" max="170" step="5" value="45" />
170
</div>
<div>
aspect 0.5<input id="aspectSlider" type="range"
min="0.5" max="2" step="0.1" value="1" />
2
</div>
<select id="Texture Style" size="4">
<option value="0">Nearest</option>
<option value="1">Linear</option>
<option value="2">MipMap Nearest</option>
<option value="3">MipMap Linear</option>
</select>
<script id="vertex-shader" type="x-shader/x-vertex">
attribute vec4 vPosition;
attribute vec4 vColor;
attribute vec2 vTexCoord;
uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;
varying vec4 fColor;
varying vec2 fTexCoord;
uniform vec3 theta;
void main()
{
fColor = vColor;
fTexCoord = vTexCoord;
gl_Position = projectionMatrix*modelViewMatrix*vPosition;
}
</script>
<script id="fragment-shader" type="x-shader/x-fragment">
precision mediump float;
varying vec4 fColor;
varying vec2 fTexCoord;
uniform sampler2D texture;
void
main()
{
gl_FragColor = fColor*texture2D( texture, fTexCoord );
}
</script>
<script type="text/javascript" src="../Common/webgl-utils.js"></script>
<script type="text/javascript" src="../Common/initShaders.js"></script>
<script type="text/javascript" src="../Common/MV.js"></script>
<script type="text/javascript" src="textureSquare.js"></script>
<body>
<canvas id="gl-canvas" width="1024" height="1024">
Oops ... your browser doesn't support the HTML5 canvas element
</canvas>
</body>
</html>