Guest User

Untitled

a guest
Jul 21st, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. double previousTime = glfwGetTime();
  2. int frameCount = 0;
  3.  
  4. while (isGameRunning)
  5. {
  6. // Measure speed
  7. double currentTime = glfwGetTime();
  8. frameCount++;
  9. // If a second has passed.
  10. if ( currentTime - previousTime >= 1.0 )
  11. {
  12. // Display the frame count here any way you want.
  13. displayFPS(frameCount);
  14.  
  15. frameCount = 0;
  16. previousTime = currentTime;
  17. }
  18.  
  19. // Rest of your game loop...
  20. }
Add Comment
Please, Sign In to add comment