aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/render
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-10-08 02:57:12 +0200
committerSven Gothel <[email protected]>2012-10-08 02:57:12 +0200
commit377c8b0c884067ea5c009a440992fef3afa92200 (patch)
tree0d9cdd4247c809e25bfd9095550401795c3a490a /src/jake2/render
parentadb08a68f994aa24aa544bb2c42462911cc76604 (diff)
JoglDriver: Add FPSCounter (all 60*5 frames) ; Remove glFlush() @ endFrame, doing swapBuffer alreadyjogl2_gl2
Diffstat (limited to 'src/jake2/render')
-rw-r--r--src/jake2/render/opengl/JoglDriver.java7
1 files changed, 6 insertions, 1 deletions
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();
}
}
}