From c6be2e43358fccf9b8e89f9ad9f55ff57fbbeb3e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 21 Oct 2020 21:23:18 +0200 Subject: Fix shader demo arguments to allow running at maximum framerate --- examples/pugl_shader_demo.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'examples') diff --git a/examples/pugl_shader_demo.c b/examples/pugl_shader_demo.c index f77d9ad..1122410 100644 --- a/examples/pugl_shader_demo.c +++ b/examples/pugl_shader_demo.c @@ -439,9 +439,10 @@ main(int argc, char** argv) const double now = puglGetTime(app.world); const double nextFrameEndTime = app.lastFrameEndTime + frameDuration; const double nextExposeTime = nextFrameEndTime - app.lastDrawDuration; - const double timeout = fmax(0.0, nextExposeTime - now); + const double timeUntilNext = nextExposeTime - now; + const double timeout = app.opts.sync ? timeUntilNext : 0.0; - puglUpdate(app.world, timeout); + puglUpdate(app.world, fmax(0.0, timeout)); puglPrintFps(app.world, &fpsPrinter, &app.framesDrawn); } -- cgit v1.2.1