Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double previousTime = glfwGetTime();
- int frameCount = 0;
- while (isGameRunning)
- {
- // Measure speed
- double currentTime = glfwGetTime();
- frameCount++;
- // If a second has passed.
- if ( currentTime - previousTime >= 1.0 )
- {
- // Display the frame count here any way you want.
- displayFPS(frameCount);
- frameCount = 0;
- previousTime = currentTime;
- }
- // Rest of your game loop...
- }
Add Comment
Please, Sign In to add comment