Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added high-erformance resolution timer for requestAnimationFrame

timestamps
  • Loading branch information...
commit ec92368291225657dfb7f13340c083d23b9c3f80 1 parent 1116939
@mikeseven authored
Showing with 6 additions and 5 deletions.
  1. +4 −4 lib/platform_glfw.js
  2. +2 −1  test/cube.js
View
8 lib/platform_glfw.js
@@ -1,4 +1,4 @@
-var GLFW = require('node-glfw');
+var GLFW = require('node-glfw');
var WebGL = require('./webgl');
module.exports = function () {
@@ -119,7 +119,7 @@ module.exports = function () {
d = delay;
}
timer(function () {
- callback(new Date().getTime());
+ callback(GLFW.GetTime()*1000.0);
}, d);
}
};
@@ -143,5 +143,5 @@ module.exports = function () {
});
return platform;
-};
-
+};
+
View
3  test/cube.js
@@ -485,7 +485,8 @@ function tick(timeNow) {
drawATB();
- requestAnimationFrame(tick);
+ gl.finish(); // for timing
+ requestAnimationFrame(tick,0);
}
function initAntTweakBar(canvas) {
Please sign in to comment.
Something went wrong with that request. Please try again.