aboutsummaryrefslogtreecommitdiffstats
path: root/examples/pugl_shader_demo.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-10-21 21:23:18 +0200
committerDavid Robillard <d@drobilla.net>2020-10-21 21:23:18 +0200
commitc6be2e43358fccf9b8e89f9ad9f55ff57fbbeb3e (patch)
tree846c48b95c7fa742553e9a3cb427bb590a2676fe /examples/pugl_shader_demo.c
parent018887074fd25e7c0865c5c8f8b377d54e87c948 (diff)
downloadpugl-c6be2e43358fccf9b8e89f9ad9f55ff57fbbeb3e.tar.gz
pugl-c6be2e43358fccf9b8e89f9ad9f55ff57fbbeb3e.tar.bz2
pugl-c6be2e43358fccf9b8e89f9ad9f55ff57fbbeb3e.zip
Fix shader demo arguments to allow running at maximum framerate
Diffstat (limited to 'examples/pugl_shader_demo.c')
-rw-r--r--examples/pugl_shader_demo.c5
1 files changed, 3 insertions, 2 deletions
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);
}