1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-05-12 12:00:13 +00:00

Compare commits

..

3 commits

Author SHA1 Message Date
Matt Kilgore be1e72e2ce
Merge cdbfb94c61 into 8514e46034 2024-04-17 00:58:33 -04:00
Matthew Kilgore cdbfb94c61 Fix GLUT redraw timing
Currently the GLUT thread draws the screen too slowly, Ex. The default
is supposed to be 60 FPS, but it will always draw a bit slower than 60
FPS. This is because the current logic simply inserts delays for the
entire length of a frame, not taking into account how long it took us to
render the last frame.

The new code uses GetTicks() to measure how much time has passed since
the last render, which then lets us calculate the exact amount of delay
until the next frame. We additionally then measure how long the delay
lasted vs. what we asked for (since any delay we do only has a minimum
guarentee, it will ocassionally last a bit longer) and adjust based on
that as well. The result is a perfect 60 FPS as long as rendering is
quick enough.

If the rendering falls behind (Ex. a slow _GL SUB is in the program)
then we'll start skipping frames to get back on track.

Fixes: #408
2024-04-17 00:58:30 -04:00
Matthew Kilgore 786f40193b Make Linux GetTicks() start from zero
Since the GetTicks() is visible in the logging, it's useful
to have it start from zero rather than an arbitrary number.
2024-04-17 00:58:30 -04:00

Diff content is not available