diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/classes/com/sun/javafx/newt/GLWindow.java | 39 | ||||
-rw-r--r-- | src/classes/com/sun/opengl/impl/glsl/shader/FixedFuncColorTexture.fp | 5 | ||||
-rwxr-xr-x | src/classes/com/sun/opengl/impl/glsl/shader/bin/nvidia/FixedFuncColorTexture.bfp | bin | 1804 -> 1804 bytes | |||
-rwxr-xr-x | src/classes/javax/media/opengl/util/FBObject.java | 2 |
4 files changed, 43 insertions, 3 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 Binary files differindex 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 diff --git a/src/classes/javax/media/opengl/util/FBObject.java b/src/classes/javax/media/opengl/util/FBObject.java index 8e27f65c6..660c8c806 100755 --- a/src/classes/javax/media/opengl/util/FBObject.java +++ b/src/classes/javax/media/opengl/util/FBObject.java @@ -118,7 +118,7 @@ public class FBObject { } else if(gl.isGLES()) { textureInternalFormat=GL.GL_RGBA; textureDataFormat=GL.GL_RGBA; - textureDataType=GL.GL_UNSIGNED_SHORT_5_5_5_1; + textureDataType=GL.GL_UNSIGNED_BYTE; } else { textureInternalFormat=GL.GL_RGB; textureDataFormat=GL.GL_RGB; |