Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void init()
- {
- lastSecond = window.performance.now();
- window.requestAnimationFrame(draw);
- }
- void draw() {
- gl.clearColor(0.8, 0.8, 0.8, 1);
- gl.clearDepth(1.0);
- gl.clear(COLOR_BUFFER_BIT | DEPTH_BUFFER_BIT);
- frameCounter++;
- double timeNow = window.performance.now();
- if (timeNow > lastSecond + 1000)
- {
- e.text = ((frameCounter * 1000) / ((timeNow - lastSecond))).toStringAsFixed(2);
- lastSecond = window.performance.now();
- frameCounter = 0;
- }
- window.requestAnimationFrame(draw);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement