From c31f64f7e1508d7aad08a043692aa123a9cebdbf Mon Sep 17 00:00:00 2001 From: "Stefanos A." Date: Sat, 11 Jan 2014 01:46:38 +0100 Subject: [PATCH] [OpenTK] Frameskip needs TargetUpdateFrequency!=0 --- Source/OpenTK/GameWindow.cs | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/Source/OpenTK/GameWindow.cs b/Source/OpenTK/GameWindow.cs index 8012eba..a4a6131 100644 --- a/Source/OpenTK/GameWindow.cs +++ b/Source/OpenTK/GameWindow.cs @@ -441,20 +441,23 @@ namespace OpenTK { // Raise UpdateFrame events until we catch up with our target update rate. double update_elapsed = MathHelper.Clamp(timestamp - update_timestamp, 0.0, 1.0); - if (RaiseUpdateFrame(update_elapsed)) + if (update_elapsed > 0) { - update_period = update_elapsed; - update_timestamp = timestamp; - timestamp = watch.Elapsed.TotalSeconds; - update_time = timestamp - update_timestamp; - } - else - { - // We have executed enough UpdateFrame events to catch up. - // Break and issue a RenderFrame event. - break; + if (RaiseUpdateFrame(update_elapsed)) + { + update_period = update_elapsed; + update_timestamp = timestamp; + timestamp = watch.Elapsed.TotalSeconds; + update_time = timestamp - update_timestamp; + } + else + { + // We have executed enough UpdateFrame events to catch up. + // Break and issue a RenderFrame event. + break; + } } - } while (++frameskip < max_frameskip); + } while (TargetRenderFrequency > 0 && ++frameskip < max_frameskip); timestamp = watch.Elapsed.TotalSeconds; double render_elapsed = MathHelper.Clamp(timestamp - render_timestamp, 0.0, 1.0); -- 2.7.4