From bf01b1e98f1759982e0ee012a3379507f3e72af7 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 21 Jan 2025 16:08:13 -0500 Subject: Fix pugl_shader_demo refresh rate on Windows --- examples/demo_utils.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'examples/demo_utils.h') diff --git a/examples/demo_utils.h b/examples/demo_utils.h index b43cc2b..da3b2cd 100644 --- a/examples/demo_utils.h +++ b/examples/demo_utils.h @@ -95,13 +95,14 @@ puglPrintFps(const PuglWorld* world, unsigned* const framesDrawn) { const double thisTime = puglGetTime(world); - if (thisTime > printer->lastReportTime + 5) { - const double fps = *framesDrawn / (thisTime - printer->lastReportTime); + if (thisTime > printer->lastReportTime + 5.0) { + const double elapsed = (thisTime - printer->lastReportTime); + const double fps = *framesDrawn / elapsed; fprintf(stderr, - "FPS: %.2f (%u frames in %.0f seconds)\n", + "FPS: %.2f (%u frames / %.2f seconds)\n", fps, *framesDrawn, - thisTime - printer->lastReportTime); + elapsed); printer->lastReportTime = thisTime; *framesDrawn = 0; -- cgit v1.2.1