Permalink
Browse files

Don't update FPS when duration isn't good

  • Loading branch information...
1 parent 057559f commit 58b50bbb6c8a7eff47e32ad58a310c239972872b @Cloudef committed Apr 22, 2012
Showing with 9 additions and 8 deletions.
  1. +9 −8 test/src/display.c
View
@@ -71,7 +71,7 @@ int main(int argc, char **argv)
glfwPollEvents();
/* rotate */
- glhckObjectRotatef(cube, 0, spin+=10.0f*delta, 0);
+ glhckObjectRotatef(cube, 0, spin = spin + 10.0f * delta, 0);
/* glhck drawing */
glhckObjectDraw(cube);
@@ -81,14 +81,15 @@ int main(int argc, char **argv)
glfwSwapBuffers();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- if (fpsDelay < glfwGetTime()) {
- if(duration > 0.0f)
+ if (fpsDelay < now) {
+ if (duration > 0.0f) {
FPS = (float)frameCounter / duration;
-
- sprintf(WIN_TITLE, "OpenGL [FPS: %d]", FPS);
- glfwSetWindowTitle(window, WIN_TITLE);
- printf("FPS: %d\n", FPS);
- frameCounter = 0; fpsDelay = now + 1; duration = 0;
+ sprintf(WIN_TITLE, "OpenGL [FPS: %d]", FPS);
+ glfwSetWindowTitle(window, WIN_TITLE);
+ printf("FPS: %d\n", FPS);
+ printf("DELTA: %f\n", delta);
+ frameCounter = 0; fpsDelay = now + 1; duration = 0;
+ }
}
++frameCounter;

0 comments on commit 58b50bb

Please sign in to comment.