summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-02-03 14:33:56 +0000
committerrodri <rgl@antares-labs.eu>2024-02-03 14:33:56 +0000
commitf8bc128e71751443550965141789cdc7c17add0e (patch)
tree66e479020b194d460ba3ee05c96ccdfef8dfec4f
parent1aacac5b602d1f09b9b8ae74ca02a8060b75c406 (diff)
download3dee-f8bc128e71751443550965141789cdc7c17add0e.tar.gz
3dee-f8bc128e71751443550965141789cdc7c17add0e.tar.bz2
3dee-f8bc128e71751443550965141789cdc7c17add0e.zip
issue screen redrawings at a fixed step.
-rw-r--r--main.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/main.c b/main.c
index adb3e14..bb9937f 100644
--- a/main.c
+++ b/main.c
@@ -321,11 +321,18 @@ redraw(void)
void
drawproc(void *)
{
+ uvlong t0, Δt;
+
threadsetname("drawproc");
+ t0 = nsec();
for(;;){
shootcamera(maincam, model, modeltex, shader);
- nbsend(drawc, nil);
+ Δt = nsec() - t0;
+ if(Δt > HZ2MS(60)*1000000ULL){
+ nbsend(drawc, nil);
+ t0 += Δt;
+ }
}
}