diff options
author | Sven Gothel <[email protected]> | 2011-04-25 15:43:21 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-04-25 15:43:21 +0200 |
commit | e24ea541924d365c8a0896245436ca55e1575a22 (patch) | |
tree | 5d88c58848d0d5802f76676a541d516d2528b00c | |
parent | 61647a8da2279e1bf04a7bbe09a8912d70e90162 (diff) |
Use less updated animator fps
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java index 7da96c5ec..5811bc916 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java @@ -28,6 +28,8 @@ package com.jogamp.opengl.test.junit.graph.demos; import java.io.IOException; + +import javax.media.opengl.FPSCounter; import javax.media.opengl.GL; import javax.media.opengl.GL2ES2; import javax.media.opengl.GLAnimatorControl; @@ -127,21 +129,21 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB } public void display(GLAutoDrawable drawable) { + final int width = drawable.getWidth(); + final int height = drawable.getHeight(); GL2ES2 gl = drawable.getGL().getGL2ES2(); gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); // Demo02 needs to have this set here as well .. hmm ? gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); final TextRenderer textRenderer = (TextRenderer) getRenderer(); + textRenderer.reshapeOrtho(null, width, height, 0.1f, 7000.0f); - final int width = drawable.getWidth(); - final int height = drawable.getHeight(); final GLAnimatorControl animator = drawable.getAnimator(); final boolean _drawFPS = drawFPS && null != animator && animator.getTotalFPSFrames()>10; - - textRenderer.reshapeOrtho(null, width, height, 0.1f, 7000.0f); + if(_drawFPS) { - final float fps = ( animator.getTotalFPSFrames() * 1000.0f ) / (float) animator.getTotalFPSDuration() ; + final float fps = animator.getTotalFPS(); final String fpsS = String.valueOf(fps); final int fpsSp = fpsS.indexOf('.'); textRenderer.resetModelview(null); |