diff options
-rwxr-xr-x | src/demos/es1/RedSquare.java | 8 | ||||
-rwxr-xr-x | src/demos/es1/angeles/Main.java | 21 | ||||
-rw-r--r-- | src/demos/es1/cube/Cube.java | 39 | ||||
-rwxr-xr-x | src/demos/es1/cubefbo/FBCubes.java | 7 | ||||
-rwxr-xr-x | src/demos/es1/cubefbo/Main.java | 21 | ||||
-rwxr-xr-x | src/demos/es2/RedSquare.java | 10 | ||||
-rw-r--r-- | src/jbullet/make-jar.sh | 2 | ||||
-rw-r--r-- | src/jbullet/src/javabullet/demos/opengl/JOGL.java | 24 | ||||
-rwxr-xr-x | wince/redsquare_true-es2-args.txt | 2 | ||||
-rwxr-xr-x | wince/redsquare_true-es2.lnk | 1 |
10 files changed, 44 insertions, 91 deletions
diff --git a/src/demos/es1/RedSquare.java b/src/demos/es1/RedSquare.java index ae6500e..07031d9 100755 --- a/src/demos/es1/RedSquare.java +++ b/src/demos/es1/RedSquare.java @@ -12,8 +12,6 @@ public class RedSquare implements MouseListener, GLEventListener { private GLWindow window; private GLU glu; private boolean quit = false; - private long startTime; - private long curTime; public void mouseClicked(MouseEvent e) { System.out.println("mouseevent: "+e); @@ -65,13 +63,13 @@ public class RedSquare implements MouseListener, GLEventListener { // window.setEventHandlerMode(GLWindow.EVENT_HANDLER_GL_CURRENT); // default // window.setEventHandlerMode(GLWindow.EVENT_HANDLER_GL_NONE); // no current .. + window.enablePerfLog(true); // Size OpenGL to Video Surface window.setSize(width, height); window.setFullscreen(true); window.setVisible(true); - startTime = System.currentTimeMillis(); - while (!quit && ((curTime = System.currentTimeMillis()) - startTime) < 20000) { + while (!quit && window.getDuration() < 20000) { window.display(); } @@ -150,7 +148,7 @@ public class RedSquare implements MouseListener, GLEventListener { gl.glMatrixMode(gl.GL_MODELVIEW); gl.glLoadIdentity(); gl.glTranslatef(0, 0, -10); - float ang = ((float) (curTime - startTime) * 360.0f) / 4000.0f; + float ang = ((float) window.getDuration() * 360.0f) / 4000.0f; gl.glRotatef(ang, 0, 0, 1); gl.glRotatef(ang, 0, 1, 0); diff --git a/src/demos/es1/angeles/Main.java b/src/demos/es1/angeles/Main.java index d5073c7..8e988ab 100755 --- a/src/demos/es1/angeles/Main.java +++ b/src/demos/es1/angeles/Main.java @@ -60,6 +60,7 @@ public class Main implements MouseListener { window.addMouseListener(this); + window.enablePerfLog(true); window.setSize(width, height); window.setFullscreen(true); window.setVisible(true); @@ -77,25 +78,9 @@ public class Main implements MouseListener { System.out.println("Using: nop .. "); } - long startTime = System.currentTimeMillis(); - long lastTime = startTime, curTime = 0, dt0, dt1; - int totalFrames = 0, lastFrames = 0; - - do { + while (!quit && window.getDuration() < 215000) { window.display(); - - totalFrames++; lastFrames++; - curTime = System.currentTimeMillis(); - dt0 = curTime-lastTime; - if ( (curTime-lastTime) > 5000 ) { - dt1 = curTime-startTime; - System.out.println(dt1/1000+"s, 5s: "+ (lastFrames*1000)/dt0 + " fps, "+ - "total: "+ (totalFrames*1000)/dt1 + " fps"); - lastTime=curTime; - lastFrames=0; - } - - } while (!quit && (curTime - startTime) < 215000); + } // Shut things down cooperatively window.close(); diff --git a/src/demos/es1/cube/Cube.java b/src/demos/es1/cube/Cube.java index dadc8bc..ffee97d 100644 --- a/src/demos/es1/cube/Cube.java +++ b/src/demos/es1/cube/Cube.java @@ -101,34 +101,36 @@ public class Cube implements GLEventListener { gl.glMatrixMode(gl.GL_MODELVIEW); gl.glLoadIdentity(); - gl.glScissor(0, 0, width, height); + // JAU gl.glScissor(0, 0, width, height); if(innerCube) { // Clear background to white - gl.glClearColor(1.0f, 1.0f, 1.0f, 0.6f); + gl.glClearColor(1.0f, 1.0f, 1.0f, 0.4f); } else { // Clear background to blue gl.glClearColor(0.0f, 0.0f, 1.0f, 1.0f); } if(!innerCube) { - gl.glLightfv(gl.GL_LIGHT0, gl.GL_POSITION, light_position, 0); - gl.glLightfv(gl.GL_LIGHT0, gl.GL_AMBIENT, light_ambient, 0); - gl.glLightfv(gl.GL_LIGHT0, gl.GL_DIFFUSE, light_diffuse, 0); - gl.glLightfv(gl.GL_LIGHT0, gl.GL_SPECULAR, zero_vec4, 0); - gl.glMaterialfv(gl.GL_FRONT_AND_BACK, gl.GL_SPECULAR, material_spec, 0); - - gl.glEnable(gl.GL_LIGHTING); - gl.glEnable(gl.GL_LIGHT0); - gl.glEnable(gl.GL_COLOR_MATERIAL); + gl.glLightfv(gl.GL_LIGHT0, gl.GL_POSITION, light_position, 0); + gl.glLightfv(gl.GL_LIGHT0, gl.GL_AMBIENT, light_ambient, 0); + gl.glLightfv(gl.GL_LIGHT0, gl.GL_DIFFUSE, light_diffuse, 0); + gl.glLightfv(gl.GL_LIGHT0, gl.GL_SPECULAR, zero_vec4, 0); + gl.glMaterialfv(gl.GL_FRONT_AND_BACK, gl.GL_SPECULAR, material_spec, 0); + + gl.glEnable(gl.GL_LIGHTING); + gl.glEnable(gl.GL_LIGHT0); + gl.glEnable(gl.GL_COLOR_MATERIAL); } else { - gl.glDisable(gl.GL_LIGHTING); - gl.glDisable(gl.GL_LIGHT0); + gl.glDisable(gl.GL_LIGHTING); + gl.glDisable(gl.GL_LIGHT0); } - gl.glEnable(gl.GL_NORMALIZE); gl.glEnable(gl.GL_CULL_FACE); + if(null!=glF) { + gl.glEnable(gl.GL_NORMALIZE); - gl.glShadeModel(gl.GL_SMOOTH); - gl.glDisable(gl.GL_DITHER); + gl.glShadeModel(gl.GL_SMOOTH); + gl.glDisable(gl.GL_DITHER); + } gl.glEnableClientState(gl.GL_VERTEX_ARRAY); gl.glEnableClientState(gl.GL_NORMAL_ARRAY); @@ -302,14 +304,13 @@ public class Cube implements GLEventListener { window.addGLEventListener(this); + window.enablePerfLog(true); // Size OpenGL to Video Surface window.setSize(width, height); window.setFullscreen(true); window.setVisible(true); - long curTime; - long startTime = System.currentTimeMillis(); - while (((curTime = System.currentTimeMillis()) - startTime) < 20000) { + while (window.getDuration() < 20000) { window.display(); } diff --git a/src/demos/es1/cubefbo/FBCubes.java b/src/demos/es1/cubefbo/FBCubes.java index 5478743..ed19c0a 100755 --- a/src/demos/es1/cubefbo/FBCubes.java +++ b/src/demos/es1/cubefbo/FBCubes.java @@ -60,9 +60,10 @@ class FBCubes implements GLEventListener { } fbo1.init(gl); - //fbo1.init(gl, GL.GL_RGB, GL.GL_RGB, GL.GL_UNSIGNED_BYTE); - //fbo1.init(gl, GL.GL_RGBA, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE); - //fbo1.init(gl, GL.GL_RGBA8, GL2.GL_BGRA, GL2.GL_UNSIGNED_INT_8_8_8_8_REV); + //fbo1.init(gl, GL.GL_RGB, GL.GL_RGB, GL.GL_UNSIGNED_BYTE); // faster + //fbo1.init(gl, GL.GL_RGBA, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE); // GLES2 default + //fbo1.init(gl, GL.GL_RGBA, GL.GL_RGBA, GL.GL_UNSIGNED_SHORT_5_5_5_1); // useless (1bit alpha) + //fbo1.init(gl, GL.GL_RGBA8, GL2.GL_BGRA, GL2.GL_UNSIGNED_INT_8_8_8_8_REV); // GL2 default cubeInner.init(drawable); cubeOuter.init(drawable); diff --git a/src/demos/es1/cubefbo/Main.java b/src/demos/es1/cubefbo/Main.java index 161d388..b23b221 100755 --- a/src/demos/es1/cubefbo/Main.java +++ b/src/demos/es1/cubefbo/Main.java @@ -58,6 +58,7 @@ public class Main implements MouseListener { window.addMouseListener(this); + window.enablePerfLog(true); window.setSize(width, height); window.setFullscreen(true); window.setVisible(true); @@ -66,25 +67,9 @@ public class Main implements MouseListener { FBCubes cubes = new FBCubes(); window.addGLEventListener(cubes); - long startTime = System.currentTimeMillis(); - long lastTime = startTime, curTime = 0, dt0, dt1; - int totalFrames = 0, lastFrames = 0; - - do { + while ( !quit && window.getDuration() < 215000) { window.display(); - - totalFrames++; lastFrames++; - curTime = System.currentTimeMillis(); - dt0 = curTime-lastTime; - if ( (curTime-lastTime) > 5000 ) { - dt1 = curTime-startTime; - System.out.println(dt1/1000+"s, 5s: "+ (lastFrames*1000)/dt0 + " fps, "+ - "total: "+ (totalFrames*1000)/dt1 + " fps"); - lastTime=curTime; - lastFrames=0; - } - - } while (!quit && (curTime - startTime) < 215000); + } // Shut things down cooperatively window.close(); diff --git a/src/demos/es2/RedSquare.java b/src/demos/es2/RedSquare.java index 6b53f04..9e74c4f 100755 --- a/src/demos/es2/RedSquare.java +++ b/src/demos/es2/RedSquare.java @@ -147,7 +147,7 @@ public class RedSquare implements MouseListener, GLEventListener { vertShader.put(tmpI); vertShader.flip(); - gl.glShaderBinaryOrSource(vertShader, 0, null, vertShaderSource); + gl.glShaderSource(vertShader, vertShaderSource); gl.glCompileShader(vertShader.get(0)); if ( ! gl.glIsShaderStatusValid(vertShader.get(0), gl.GL_COMPILE_STATUS) ) { System.err.println("Failed to compile vertex shader: id "+vertShader.get(0)+ @@ -160,7 +160,7 @@ public class RedSquare implements MouseListener, GLEventListener { fragShader.put(tmpI); fragShader.flip(); - gl.glShaderBinaryOrSource(fragShader, 0, null, fragShaderSource); + gl.glShaderSource(fragShader, fragShaderSource); gl.glCompileShader(fragShader.get(0)); @@ -196,7 +196,7 @@ public class RedSquare implements MouseListener, GLEventListener { shaderPMVMatrix = gl.glGetUniformLocation(shaderProgram, "mgl_PMVMatrix"); if(0<=shaderPMVMatrix) { - gl.glUniformMatrix4fv(shaderPMVMatrix, 2, false, pmvMatrix.glGetPMVMatrixf()); + gl.glUniformMatrix4fv(shaderPMVMatrix, 2, false, pmvMatrix.glGetPMvMatrixf()); } else { System.err.println("could not get uniform mgl_PMVMatrix: "+shaderPMVMatrix); return; @@ -262,7 +262,7 @@ public class RedSquare implements MouseListener, GLEventListener { //pmvMatrix.glOrthof(-4.0f, 4.0f, -4.0f, 4.0f, 1.0f, 100.0f); if(0<=shaderPMVMatrix) { - gl.glUniformMatrix4fv(shaderPMVMatrix, 2, false, pmvMatrix.glGetPMVMatrixf()); + gl.glUniformMatrix4fv(shaderPMVMatrix, 2, false, pmvMatrix.glGetPMvMatrixf()); } } @@ -282,7 +282,7 @@ public class RedSquare implements MouseListener, GLEventListener { pmvMatrix.glRotatef(ang, 0, 1, 0); if(0<=shaderPMVMatrix) { - gl.glUniformMatrix4fv(shaderPMVMatrix, 2, false, pmvMatrix.glGetPMVMatrixf()); + gl.glUniformMatrix4fv(shaderPMVMatrix, 2, false, pmvMatrix.glGetPMvMatrixf()); } // Draw a square diff --git a/src/jbullet/make-jar.sh b/src/jbullet/make-jar.sh index 4f98e1d..c991a61 100644 --- a/src/jbullet/make-jar.sh +++ b/src/jbullet/make-jar.sh @@ -1,7 +1,7 @@ rm -f ragdoll.jar cd build/classes/ jar xf ../../lib/vecmath.jar -jar xf ../../lib/trove.jar +#jar xf ../../lib/trove.jar cp -a ../../lib/java . rm -rf META-INF find . -name \*nope -exec rm -fv \{\} \; diff --git a/src/jbullet/src/javabullet/demos/opengl/JOGL.java b/src/jbullet/src/javabullet/demos/opengl/JOGL.java index 3333145..0f3c11c 100644 --- a/src/jbullet/src/javabullet/demos/opengl/JOGL.java +++ b/src/jbullet/src/javabullet/demos/opengl/JOGL.java @@ -90,6 +90,7 @@ public class JOGL implements MouseListener { // window.setEventHandlerMode(GLWindow.EVENT_HANDLER_GL_CURRENT); // default // window.setEventHandlerMode(GLWindow.EVENT_HANDLER_GL_NONE); // no current .. + window.enablePerfLog(true); // Size OpenGL to Video Surface window.setSize(width, height); window.setFullscreen(true); @@ -97,29 +98,8 @@ public class JOGL implements MouseListener { width = window.getWidth(); height = window.getHeight(); - long startTime = System.currentTimeMillis(); - long lastTime = startTime, curTime = 0, dt0, dt1; - int totalFrames = 0, lastFrames = 0; - - while (!quit) { + while (!quit && window.getDuration() < 200000) { window.display(); - - totalFrames++; lastFrames++; - curTime = System.currentTimeMillis(); - dt0 = curTime-lastTime; - if ( (curTime-lastTime) > 5000 ) { - dt1 = curTime-startTime; - StringBuffer sb = new StringBuffer(); - sb.append(dt1/1000); - sb.append("s, 5s: "); - sb.append((lastFrames*1000)/dt0); - sb.append(" fps, total: "); - sb.append((totalFrames*1000)/dt1); - sb.append(" fps"); - System.out.println(sb); - lastTime=curTime; - lastFrames=0; - } } // Shut things down cooperatively diff --git a/wince/redsquare_true-es2-args.txt b/wince/redsquare_true-es2-args.txt new file mode 100755 index 0000000..cb99053 --- /dev/null +++ b/wince/redsquare_true-es2-args.txt @@ -0,0 +1,2 @@ +"-Dsun.boot.library.path=\Storage Card\bin" "-Xbootclasspath/a:\Storage Card\gluegen-rt.jar" "-Xbootclasspath/a:\Storage Card\jogl.core.jar" "-Xbootclasspath/a:\Storage Card\jogl.egl.jar" "-Xbootclasspath/a:\Storage Card\jogl.gles2.jar" "-Xbootclasspath/a:\Storage Card\newt.jar" "-Xbootclasspath/a:\Storage Card\jogl-demos.jar" "-Xopt:stdioPrefix=\Storage Card" demos.es2.RedSquare + diff --git a/wince/redsquare_true-es2.lnk b/wince/redsquare_true-es2.lnk new file mode 100755 index 0000000..643186d --- /dev/null +++ b/wince/redsquare_true-es2.lnk @@ -0,0 +1 @@ +01#"\Storage Card\bin\cvm.exe" -f "\Storage Card\redsquare_true-es2-args.txt" |