aboutsummaryrefslogtreecommitdiffstats
path: root/src/classes/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/classes/com')
-rw-r--r--src/classes/com/sun/javafx/newt/GLWindow.java39
-rw-r--r--src/classes/com/sun/opengl/impl/glsl/shader/FixedFuncColorTexture.fp5
-rwxr-xr-xsrc/classes/com/sun/opengl/impl/glsl/shader/bin/nvidia/FixedFuncColorTexture.bfpbin1804 -> 1804 bytes
3 files changed, 42 insertions, 2 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 {
diff --git a/src/classes/com/sun/opengl/impl/glsl/shader/FixedFuncColorTexture.fp b/src/classes/com/sun/opengl/impl/glsl/shader/FixedFuncColorTexture.fp
index cc4bd0c64..804de9f64 100644
--- a/src/classes/com/sun/opengl/impl/glsl/shader/FixedFuncColorTexture.fp
+++ b/src/classes/com/sun/opengl/impl/glsl/shader/FixedFuncColorTexture.fp
@@ -31,8 +31,9 @@ vec4 getTexColor(in sampler2D tex, in int idx) {
void main (void)
{
vec4 texColor = getTexColor(mgl_ActiveTexture,mgl_ActiveTextureIdx);
- if(length(texColor)>0.0) {
- gl_FragColor = vec4(frontColor.rgb*texColor.rgb, frontColor.a * texColor.a) ;
+
+ if(length(texColor.rgb)>0.0) {
+ gl_FragColor = vec4(frontColor.rgb*texColor.rgb, frontColor.a) ;
} else {
gl_FragColor = frontColor;
}
diff --git a/src/classes/com/sun/opengl/impl/glsl/shader/bin/nvidia/FixedFuncColorTexture.bfp b/src/classes/com/sun/opengl/impl/glsl/shader/bin/nvidia/FixedFuncColorTexture.bfp
index 375ea6293..b2dd5bab6 100755
--- a/src/classes/com/sun/opengl/impl/glsl/shader/bin/nvidia/FixedFuncColorTexture.bfp
+++ b/src/classes/com/sun/opengl/impl/glsl/shader/bin/nvidia/FixedFuncColorTexture.bfp
Binary files differ