-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfps.html
62 lines (46 loc) · 1.05 KB
/
fps.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
<!doctype html>
<html>
<head>
<script type="text/javascript" src="jquery-1.4.3.min.js"></script>
<script type="text/javascript">
var canvas;
var gl;
var currentTime;
$(document).ready(function() {
$('body:first').bind("onload",start());
});
function start() {
fpsDiv = document.createElement('div');
$('body').append(fpsDiv);
canvas = document.getElementById('glcanvas');
initWebGL(canvas);
function shadersReady(ready) {
initBuffers();
gl.clearColor(0.0, 0.0, 0.0, 1.0);
gl.enable(gl.DEPTH_TEST);
gl.depthFunc(gl.LEQUAL);
gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT);
currentTime = Date.now();
tick();
}
initShaders(shadersReady);
};
function tick() {
requestAnimFrame(tick);
drawScene();
animate();
};
function animate() {
var delta = Date.now() - currentTime;
currentTime = Date.now();
$(fpsDiv).html(delta);
// rPyramid += (90*delta) / 1000.0;
// rCube += (75*delta) / 1000.0;
// rPenta += (75*delta) / 1000.0;
};
</script>
</head>
<body>
<canvas id='canvas' width=500 height=500></canvas>
</body>
</html>