aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-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);
}