aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun/javafx/newt
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2008-08-12 12:32:32 +0000
committerSven Gothel <[email protected]>2008-08-12 12:32:32 +0000
commit65d46b634610cfb40f0ed25394bc0058b6ef420d (patch)
tree2b723fc9eb95748137a533c28e780cd5a547262a /src/classes/com/sun/javafx/newt
parent9517539e3b43d21017465180376329439bc25f12 (diff)
GLWindow: Added perf logging; FBO: adjusted texture format; Fixed: ColorTexture fix for ES2
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1750 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/classes/com/sun/javafx/newt')
-rw-r--r--src/classes/com/sun/javafx/newt/GLWindow.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/classes/com/sun/javafx/newt/GLWindow.java b/src/classes/com/sun/javafx/newt/GLWindow.java
index e46416a1d..baabd25a6 100644
--- a/src/classes/com/sun/javafx/newt/GLWindow.java
+++ b/src/classes/com/sun/javafx/newt/GLWindow.java
@@ -149,6 +149,12 @@ public class GLWindow extends Window implements GLAutoDrawable {
return window.getDisplayHeight();
}
+ public boolean getPerfLogEnabled() { return perfLog; }
+
+ public void enablePerfLog(boolean v) {
+ perfLog = v;
+ }
+
/**
* Sets the event handling mode.
*
@@ -308,6 +314,7 @@ public class GLWindow extends Window implements GLAutoDrawable {
private GLDrawableHelper helper = new GLDrawableHelper();
// To make reshape events be sent immediately before a display event
private boolean sendReshape;
+ private boolean perfLog = false;
public GLDrawableFactory getFactory() {
return factory;
@@ -365,6 +372,12 @@ public class GLWindow extends Window implements GLAutoDrawable {
class InitAction implements Runnable {
public void run() {
helper.init(GLWindow.this);
+ startTime = System.currentTimeMillis();
+ curTime = startTime;
+ if(perfLog) {
+ lastCheck = startTime;
+ totalFrames = 0; lastFrames = 0;
+ }
}
}
private InitAction initAction = new InitAction();
@@ -380,9 +393,35 @@ public class GLWindow extends Window implements GLAutoDrawable {
}
helper.display(GLWindow.this);
+
+ curTime = System.currentTimeMillis();
+ totalFrames++;
+
+ if(perfLog) {
+ long dt0, dt1;
+ lastFrames++;
+ dt0 = curTime-lastCheck;
+ if ( dt0 > 5000 ) {
+ dt1 = curTime-startTime;
+ System.out.println(dt1/1000+"s, 5s: "+ (lastFrames*1000)/dt0 + " fps, "+
+ "total: "+ (totalFrames*1000)/dt1 + " fps");
+ lastCheck=curTime;
+ lastFrames=0;
+ }
+ }
}
}
+ public long getStartTime() { return startTime; }
+ public long getCurrentTime() { return curTime; }
+ public long getDuration() { return curTime-startTime; }
+ public int getTotalFrames() { return totalFrames; }
+
+ private long startTime = 0;
+ private long curTime = 0;
+ private long lastCheck = 0;
+ private int totalFrames = 0, lastFrames = 0;
+
private DisplayAction displayAction = new DisplayAction();
class SwapBuffersAction implements Runnable {