Skip to content
Snippets Groups Projects
Commit c70f34ee authored by JonShard's avatar JonShard
Browse files

Added frame counter and more printout info in the main loop.

parent 4d253a83
No related branches found
No related tags found
No related merge requests found
......@@ -77,8 +77,8 @@ int main(int argc, char** args)
//exit(0); // for performance analysis
float oldT = 0, t = 0, dt = 0;
float oldT = 0, t = 0, dt = 0, frameTime = 0;
int frameRate = 0, oldFrameRate = 0;
for(;;)
{
t = (float)glfwGetTime();
......@@ -86,6 +86,22 @@ int main(int argc, char** args)
if ((glfwGetKey(C::window, GLFW_KEY_ESCAPE) == GLFW_PRESS || glfwWindowShouldClose(C::window) != 0))
break;
frameTime += dt;
frameRate++;
if (frameTime > 1) // Count frames.
{
frameTime -= 1;
oldFrameRate = frameRate;
frameRate = 0;
}
LOG_DEBUG("\n\nNEW FRAME"
"\n###################################################################"
"\n###################################################################"
"\nFrame rate: %d\nLast frame dt: %f\nTotal runtime: %f\n\n", oldFrameRate, dt, t);
Renderer::clear();
Scene::update(dt);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment