From 377c8b0c884067ea5c009a440992fef3afa92200 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 8 Oct 2012 02:57:12 +0200 Subject: JoglDriver: Add FPSCounter (all 60*5 frames) ; Remove glFlush() @ endFrame, doing swapBuffer already --- src/jake2/render/opengl/JoglDriver.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/jake2/render/opengl/JoglDriver.java b/src/jake2/render/opengl/JoglDriver.java index 87cfd9f..8a1818a 100644 --- a/src/jake2/render/opengl/JoglDriver.java +++ b/src/jake2/render/opengl/JoglDriver.java @@ -43,6 +43,8 @@ import javax.media.opengl.*; import javax.media.opengl.awt.GLCanvas; import javax.swing.ImageIcon; +import jogamp.opengl.FPSCounterImpl; + /** * JoglCommon */ @@ -360,7 +362,6 @@ public abstract class JoglDriver extends JoglGL implements GLDriver { } public void endFrame() { - glFlush(); display.update(); } @@ -392,10 +393,13 @@ public abstract class JoglDriver extends JoglGL implements GLDriver { @SuppressWarnings("serial") private static class Display extends GLCanvas { + final FPSCounterImpl fpsCounter; public Display(GLCapabilities capabilities) { super(capabilities); setAutoSwapBufferMode(false); + fpsCounter = new FPSCounterImpl(); + fpsCounter.setUpdateFPSFrames(60*5, System.err); // all 5s in 60hz mode } @Override @@ -440,6 +444,7 @@ public abstract class JoglDriver extends JoglGL implements GLDriver { void update() { release(); swapBuffers(); + fpsCounter.tickFPS(); } } } -- cgit v1.2.3