-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
164 lines (94 loc) · 4.77 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
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<DOCTYPE html>
<html>
<head>
<title>tic tac toe — Textures</title>
<meta http-equiv="content-type" charset="utf-8" content="text/html; utf-8">
<link rel="stylesheet" href="css/bootstrap-grid.css" type="text/css">
<link rel="stylesheet" href="css/bootstrap.css" type="text/css">
<script id="shader-vs" type="x-shader/x-vertex">
attribute vec3 aVertexPosition;
attribute vec2 aTextureCoord;
uniform mat4 uMVMatrix;
uniform mat4 uPMatrix;
varying vec2 vTextureCoord;
void main(void) {
gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);
// For the fragment shader
vTextureCoord = aTextureCoord;
}
</script>
<script id="shader-vs2" type="x-shader/x-vertex">
attribute vec3 aVertexPosition;
attribute vec3 aVertexColor;
uniform mat4 uMVMatrix;
uniform mat4 uPMatrix;
varying vec4 vertexColor;
void main(void) {
// To allow seeing the points drawn
gl_PointSize = 5.0;
// Just converting the (x,y,z) vertices to Homogeneous Coord.
// And multiplying by the Projection and the Model-View matrix
gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);
// Converting the RGB color value to RGBA
vertexColor = vec4(aVertexColor, 1.0);
}
</script>
<script id="shader-fs" type="x-shader/x-fragment">
precision mediump float;
varying vec2 vTextureCoord;
uniform sampler2D uSampler;
void main(void) {
gl_FragColor = texture2D(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));
}
</script>
<script id="shader-fs2" type="x-shader/x-fragment">
precision mediump float;
varying vec4 vertexColor;
void main(void) {
// Using the passed vertex color
gl_FragColor = vertexColor;
}
</script>
<!-- The JS files -->
<!-- Some useful functions for browser compatibility -->
<script type="text/javascript" src="js/webgl-utils.js"></script>
<!-- Handling vectors and matrices -->
<script type="text/javascript" src="js/maths.js"></script>
<!-- WebGL code -->
<script type="text/javascript" src="js/initShaders.js"></script>
<script type="text/javascript" src="js/TicTacToeColor.js"></script>
<script type="text/javascript" src="js/TicTacToe.js"></script>
</head>
<body onload="runWebGL();" >
<div class="container" style="width: 100%">
<div class="row">
<div class="col-md-3">
<h2 style="text-align: center; margin-top: 30%; font-weight:bold;"> Jogador 1 </h2>
<div style="display: grid; margin-top: 30px">
<img src="images/x.jpg" style="margin: auto">
</div>
<h2 style="text-align: center; margin-top: 30px; font-weight:bold" id = "vit1" >Vitórias: 0</h2>
</div>
<div class="col-md-6">
<div style="text-align: center">
<p><h1 style="color : b2b2b2; font-size:550%; font-weight:bold"> Tic Tac Toe 3D </h1></p>
<p id="info" style="font-size:550%; font-weight:bold"></p>
<canvas id="my-canvas" style="border:1px solid #000000; style="background-color:red";" width="800" height="800"></canvas>
<p>
<button id="reset" style="border-radius:12px; background-color:b2b2b2; border:1px solid black; font-size:24px; color: black; font-weight:bold; margin:2px">Reset</button>
<button id="new_game" style="border-radius:12px; background-color:b2b2b2; border:1px solid black; font-size:24px; color: black; font-weight:bold; margin:2px; visibility: hidden;">New Game</button>
</p>
<canvas id="my-canvas2" style="border:1px solid #000000;" width="800" height="800"></canvas>
</div>
</div>
<div class="col-md-3">
<h2 style="text-align: center; margin-top: 30%; font-weight:bold;"> Jogador 2 </h2>
<div style="display: grid; margin-top: 30px">
<img src="images/bola.jpg" style="margin: auto; height="256" width="256"; ">
</div>
<h2 style="text-align: center; margin-top: 30px; font-weight:bold" id = "vit2">Vitórias: 0</h2>
</div>
</div>
</div>
</body>
</html>