From dec9e8d90b2ead8bb196c1f099003dad3e74d65e Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Fri, 24 Jul 2020 12:48:40 +0300 Subject: [PATCH] Limit GUI redraw rate --- applications/gui2/src/main.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/applications/gui2/src/main.cpp b/applications/gui2/src/main.cpp index 85d6c38d3..bbdd04963 100644 --- a/applications/gui2/src/main.cpp +++ b/applications/gui2/src/main.cpp @@ -106,7 +106,7 @@ void FTLGui::mainloop() { screen_->setVisible(true); screen_->drawAll(); - //float last_draw_time = 0.0f; + float last_draw_time = 0.0f; while (ftl::running) { if (!screen_->visible()) { @@ -117,8 +117,8 @@ void FTLGui::mainloop() { ftl::running = false; } else { - //float now = float(glfwGetTime()); - //float delta = now - last_draw_time; + float now = float(glfwGetTime()); + float delta = now - last_draw_time; // Generate poses and render and virtual frame here // at full FPS (25 without VR and 90 with VR currently) @@ -127,10 +127,10 @@ void FTLGui::mainloop() { io_->feed()->render(); // Only draw the GUI at 25fps - //if (delta >= 0.04f) { - // last_draw_time = now; + if (delta >= 0.04f) { + last_draw_time = now; screen_->drawAll(); - //} + } } // Wait for mouse/keyboard or empty refresh events -- GitLab