diff options
Diffstat (limited to 'src/test/com/jogamp')
11 files changed, 66 insertions, 49 deletions
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTElektronActivity.java b/src/test/com/jogamp/opengl/test/android/NEWTElektronActivity.java index 74419e564..d1c8f2743 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTElektronActivity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTElektronActivity.java @@ -52,10 +52,6 @@ public class NEWTElektronActivity extends NewtBaseActivity { // create GLWindow (-> incl. underlying NEWT Display, Screen & Window) GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2)); - caps.setRedBits(5); - caps.setGreenBits(6); - caps.setBlueBits(5); - caps.setAlphaBits(0); Log.d(TAG, "req caps: "+caps); GLWindow glWindow = GLWindow.create(caps); glWindow.setFullscreen(true); @@ -70,9 +66,12 @@ public class NEWTElektronActivity extends NewtBaseActivity { }); glWindow.setVisible(true); Animator animator = new Animator(glWindow); - animator.setUpdateFPSFrames(60, System.err); setAnimator(animator); + animator.setUpdateFPSFrames(60, System.err); + animator.resetFPSCounter(); + glWindow.resetFPSCounter(); + Log.d(TAG, "onCreate - X"); } } diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java index ba861d012..c24c3af28 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java @@ -59,9 +59,10 @@ public class NEWTGearsES1Activity extends NewtBaseActivity { caps.setAlphaBits(0); */ Log.d(TAG, "req caps: "+caps); GLWindow glWindow = GLWindow.create(caps); + glWindow.setFullscreen(true); setContentView(getWindow(), glWindow); - glWindow.addGLEventListener(new GearsES1(1)); + glWindow.addGLEventListener(new GearsES1(-1)); glWindow.getScreen().addScreenModeListener(new ScreenModeListener() { public void screenModeChangeNotify(ScreenMode sm) { } public void screenModeChanged(ScreenMode sm, boolean success) { @@ -70,9 +71,12 @@ public class NEWTGearsES1Activity extends NewtBaseActivity { }); glWindow.setVisible(true); Animator animator = new Animator(glWindow); - animator.setUpdateFPSFrames(60, System.err); setAnimator(animator); + animator.setUpdateFPSFrames(60, System.err); + animator.resetFPSCounter(); + glWindow.resetFPSCounter(); + Log.d(TAG, "onCreate - X"); } } diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java index 89ecf4cb9..c0eaec842 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java @@ -52,17 +52,12 @@ public class NEWTGearsES2Activity extends NewtBaseActivity { // create GLWindow (-> incl. underlying NEWT Display, Screen & Window) GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2)); - /* - caps.setRedBits(5); - caps.setGreenBits(6); - caps.setBlueBits(5); - caps.setAlphaBits(0); */ Log.d(TAG, "req caps: "+caps); GLWindow glWindow = GLWindow.create(caps); glWindow.setFullscreen(true); setContentView(getWindow(), glWindow); - GearsES2 demo = new GearsES2(0); + GearsES2 demo = new GearsES2(-1); // demo.enableAndroidTrace(true); glWindow.addGLEventListener(demo); glWindow.getScreen().addScreenModeListener(new ScreenModeListener() { @@ -72,13 +67,16 @@ public class NEWTGearsES2Activity extends NewtBaseActivity { } }); Animator animator = new Animator(glWindow); - animator.setUpdateFPSFrames(60, System.err); // animator.setRunAsFastAsPossible(true); setAnimator(animator); // glWindow.setSkipContextReleaseThread(animator.getThread()); glWindow.setVisible(true); + animator.setUpdateFPSFrames(60, System.err); + animator.resetFPSCounter(); + glWindow.resetFPSCounter(); + Log.d(TAG, "onCreate - X"); } } diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivity.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivity.java index d6b7507a3..9e50a1be1 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivity.java @@ -32,6 +32,8 @@ import javax.media.opengl.GLProfile; import jogamp.newt.driver.android.NewtBaseActivity; +import com.jogamp.newt.NewtFactory; +import com.jogamp.newt.Screen; import com.jogamp.newt.ScreenMode; import com.jogamp.newt.event.ScreenModeListener; import com.jogamp.newt.opengl.GLWindow; @@ -53,14 +55,16 @@ public class NEWTGearsES2TransActivity extends NewtBaseActivity { // create GLWindow (-> incl. underlying NEWT Display, Screen & Window) GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2)); caps.setBackgroundOpaque(false); + Log.d(TAG, "req caps: "+caps); - GLWindow glWindow = GLWindow.create(caps); - glWindow.setSize(300, 300); - // glWindow.setFullscreen(true); + Screen screen = NewtFactory.createScreen(NewtFactory.createDisplay(null), 0); + screen.addReference(); + GLWindow glWindow = GLWindow.create(screen, caps); + glWindow.setSize(2*screen.getWidth()/3, 2*screen.getHeight()/3); glWindow.setUndecorated(true); setContentView(getWindow(), glWindow); - glWindow.addGLEventListener(new GearsES2(1)); + glWindow.addGLEventListener(new GearsES2(-1)); glWindow.getScreen().addScreenModeListener(new ScreenModeListener() { public void screenModeChangeNotify(ScreenMode sm) { } public void screenModeChanged(ScreenMode sm, boolean success) { @@ -68,12 +72,16 @@ public class NEWTGearsES2TransActivity extends NewtBaseActivity { } }); Animator animator = new Animator(glWindow); - animator.setUpdateFPSFrames(60, System.err); setAnimator(animator); // glWindow.setSkipContextReleaseThread(animator.getThread()); glWindow.setVisible(true); + animator.setUpdateFPSFrames(60, System.err); + animator.resetFPSCounter(); + glWindow.resetFPSCounter(); + + screen.removeReference(); Log.d(TAG, "onCreate - X"); } } diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivity.java b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivity.java index 1efedcd6d..b8bf285c6 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivity.java @@ -69,9 +69,12 @@ public class NEWTGraphUI1pActivity extends NewtBaseActivity { }); glWindow.setVisible(true); Animator animator = new Animator(glWindow); - animator.setUpdateFPSFrames(60, System.err); setAnimator(animator); + animator.setUpdateFPSFrames(60, System.err); + animator.resetFPSCounter(); + glWindow.resetFPSCounter(); + Log.d(TAG, "onCreate - X"); } } diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivity.java b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivity.java index 39fb5e2cc..103af1aab 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivity.java @@ -70,9 +70,12 @@ public class NEWTGraphUI2pActivity extends NewtBaseActivity { }); glWindow.setVisible(true); Animator animator = new Animator(glWindow); - animator.setUpdateFPSFrames(60, System.err); setAnimator(animator); + animator.setUpdateFPSFrames(60, System.err); + animator.resetFPSCounter(); + glWindow.resetFPSCounter(); + Log.d(TAG, "onCreate - X"); } } diff --git a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1Activity.java b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1Activity.java index 99d7fd723..a394482fc 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1Activity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1Activity.java @@ -52,15 +52,11 @@ public class NEWTRedSquareES1Activity extends NewtBaseActivity { // create GLWindow (-> incl. underlying NEWT Display, Screen & Window) GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES1)); - caps.setRedBits(5); - caps.setGreenBits(6); - caps.setBlueBits(5); - caps.setAlphaBits(0); Log.d(TAG, "req caps: "+caps); GLWindow glWindow = GLWindow.create(caps); setContentView(getWindow(), glWindow); - glWindow.addGLEventListener(new RedSquareES1(1)); + glWindow.addGLEventListener(new RedSquareES1(-1)); glWindow.getScreen().addScreenModeListener(new ScreenModeListener() { public void screenModeChangeNotify(ScreenMode sm) { } public void screenModeChanged(ScreenMode sm, boolean success) { @@ -69,9 +65,12 @@ public class NEWTRedSquareES1Activity extends NewtBaseActivity { }); glWindow.setVisible(true); Animator animator = new Animator(glWindow); - animator.setUpdateFPSFrames(60, System.err); setAnimator(animator); + animator.setUpdateFPSFrames(60, System.err); + animator.resetFPSCounter(); + glWindow.resetFPSCounter(); + Log.d(TAG, "onCreate - X"); } } diff --git a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2Activity.java b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2Activity.java index 804e627a5..889e0944e 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2Activity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2Activity.java @@ -52,16 +52,14 @@ public class NEWTRedSquareES2Activity extends NewtBaseActivity { // create GLWindow (-> incl. underlying NEWT Display, Screen & Window) GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2)); - caps.setRedBits(5); - caps.setGreenBits(6); - caps.setBlueBits(5); - caps.setAlphaBits(0); Log.d(TAG, "req caps: "+caps); GLWindow glWindow = GLWindow.create(caps); - glWindow.setFullscreen(true); + // glWindow.setSize(200, 200); + // glWindow.setUndecorated(true); + glWindow.setFullscreen(true); setContentView(getWindow(), glWindow); - final RedSquareES2 demo = new RedSquareES2(0); + final RedSquareES2 demo = new RedSquareES2(-1); // demo.enableAndroidTrace(true); glWindow.addGLEventListener(demo); glWindow.getScreen().addScreenModeListener(new ScreenModeListener() { @@ -71,12 +69,14 @@ public class NEWTRedSquareES2Activity extends NewtBaseActivity { } }); Animator animator = new Animator(glWindow); - animator.setUpdateFPSFrames(60, System.err); // animator.setRunAsFastAsPossible(true); setAnimator(animator); // glWindow.setSkipContextReleaseThread(animator.getThread()); glWindow.setVisible(true); + animator.setUpdateFPSFrames(60, System.err); + animator.resetFPSCounter(); + glWindow.resetFPSCounter(); Log.d(TAG, "onCreate - X"); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java index b5a729e02..fb2c9c7ea 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java @@ -48,7 +48,6 @@ public class GearsES1 implements GLEventListener { private GearsObject gear1=null, gear2=null, gear3=null; private float angle = 0.0f; private int swapInterval; - private boolean initialized = false; private int prevMouseX, prevMouseY; @@ -83,7 +82,6 @@ public class GearsES1 implements GLEventListener { public void init(GLAutoDrawable drawable) { System.err.println(Thread.currentThread()+" GearsES1.init ..."); - initialized = true; // Use debug pipeline // drawable.setGL(new DebugGL(drawable.getGL())); @@ -150,12 +148,16 @@ public class GearsES1 implements GLEventListener { gl.setSwapInterval(swapInterval); - float h = (float)height / (float)width; - gl.glMatrixMode(GL2ES1.GL_PROJECTION); gl.glLoadIdentity(); - gl.glFrustum(-1.0f, 1.0f, -h, h, 5.0f, 60.0f); + if(height>width) { + float h = (float)height / (float)width; + gl.glFrustumf(-1.0f, 1.0f, -h, h, 5.0f, 60.0f); + } else { + float h = (float)width / (float)height; + gl.glFrustumf(-h, h, -1.0f, 1.0f, 5.0f, 60.0f); + } gl.glMatrixMode(GL2ES1.GL_MODELVIEW); gl.glLoadIdentity(); gl.glTranslatef(0.0f, 0.0f, -40.0f); @@ -164,7 +166,6 @@ public class GearsES1 implements GLEventListener { public void dispose(GLAutoDrawable drawable) { System.err.println(Thread.currentThread()+" GearsES1.dispose ... "); - initialized = false; GL gl = drawable.getGL(); gear1.destroy(gl); gear1 = null; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java index 5a106901d..81e3a5c80 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java @@ -174,9 +174,7 @@ public class GearsES2 implements GLEventListener { } st.useProgram(gl, false); - if(0<=swapInterval) { - gl.setSwapInterval(swapInterval); - } + gl.setSwapInterval(swapInterval); System.err.println(Thread.currentThread()+" GearsES2.init FIN"); } @@ -189,12 +187,18 @@ public class GearsES2 implements GLEventListener { System.err.println(Thread.currentThread()+" GearsES2.reshape "+x+"/"+y+" "+width+"x"+height+", swapInterval "+swapInterval); GL2ES2 gl = drawable.getGL().getGL2ES2(); - float h = (float)height / (float)width; - st.useProgram(gl, true); pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); pmvMatrix.glLoadIdentity(); - pmvMatrix.glFrustumf(-1.0f, 1.0f, -h, h, 5.0f, 60.0f); + + if(height>width) { + float h = (float)height / (float)width; + pmvMatrix.glFrustumf(-1.0f, 1.0f, -h, h, 5.0f, 60.0f); + } else { + float h = (float)width / (float)height; + pmvMatrix.glFrustumf(-h, h, -1.0f, 1.0f, 5.0f, 60.0f); + } + pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); pmvMatrix.glTranslatef(0.0f, 0.0f, -40.0f); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java index 6f3438ec8..dcda10426 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java @@ -122,9 +122,7 @@ public class RedSquareES2 implements GLEventListener { gl.glEnable(GL2ES2.GL_DEPTH_TEST); st.useProgram(gl, false); - if(0<=swapInterval) { - gl.setSwapInterval(swapInterval); - } + gl.setSwapInterval(swapInterval); if (glad instanceof GLWindow) { glWindow = (GLWindow) glad; |