From 6a56d42079f59fd7468a683fd90a1cb17e20eede Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Thu, 20 Apr 2006 18:36:14 +0000 Subject: [PATCH] Use an LWJGL support function to cap our frame rate at 60 when we're not visible and can't rely on the vsync doing it for us. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4039 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/java/com/threerings/jme/JmeApp.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/java/com/threerings/jme/JmeApp.java b/src/java/com/threerings/jme/JmeApp.java index 88fd42dd4..15407fdbc 100644 --- a/src/java/com/threerings/jme/JmeApp.java +++ b/src/java/com/threerings/jme/JmeApp.java @@ -27,6 +27,8 @@ import com.samskivert.util.Queue; import com.samskivert.util.RunQueue; import com.samskivert.util.StringUtil; +import org.lwjgl.opengl.Display; + import com.jme.renderer.Camera; import com.jme.renderer.ColorRGBA; import com.jme.renderer.Renderer; @@ -160,6 +162,10 @@ public class JmeApp processEvents(frameStart); _failures = 0; + // cap our frame rate at 60 if we're not visible and thus don't + // automatically cap due to being vsynced + Display.sync(60); + } catch (Throwable t) { Log.logStackTrace(t); // stick a fork in things if we fail too many times in a row