summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/com/jogamp/opengl/test/android/NEWTElektronActivity.java3
-rw-r--r--src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java2
-rw-r--r--src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java3
-rw-r--r--src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivity.java77
-rw-r--r--src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivity.java3
-rw-r--r--src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivity.java3
-rw-r--r--src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1Activity.java2
-rw-r--r--src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2Activity.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java15
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java53
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java2
12 files changed, 150 insertions, 22 deletions
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTElektronActivity.java b/src/test/com/jogamp/opengl/test/android/NEWTElektronActivity.java
index b36f567bb..442400868 100644
--- a/src/test/com/jogamp/opengl/test/android/NEWTElektronActivity.java
+++ b/src/test/com/jogamp/opengl/test/android/NEWTElektronActivity.java
@@ -57,7 +57,8 @@ public class NEWTElektronActivity extends NewtBaseActivity {
// caps.setSampleBuffers(true);
Log.d(TAG, "req caps: "+caps);
GLWindow glWindow = GLWindow.create(caps);
- setContentView(glWindow);
+ glWindow.setFullscreen(true);
+ setContentView(getWindow(), glWindow);
glWindow.addGLEventListener(new ElektronenMultiplizierer());
glWindow.getWindow().getScreen().addScreenModeListener(new ScreenModeListener() {
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java
index 897df89cd..bc4e7d394 100644
--- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java
+++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java
@@ -54,7 +54,7 @@ public class NEWTGearsES1Activity extends NewtBaseActivity {
GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES1));
Log.d(TAG, "req caps: "+caps);
GLWindow glWindow = GLWindow.create(caps);
- setContentView(glWindow);
+ setContentView(getWindow(), glWindow);
glWindow.addGLEventListener(new GearsES1(1));
glWindow.getWindow().getScreen().addScreenModeListener(new ScreenModeListener() {
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java
index b19c12d4a..939bfa210 100644
--- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java
+++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java
@@ -54,7 +54,8 @@ public class NEWTGearsES2Activity extends NewtBaseActivity {
GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2));
Log.d(TAG, "req caps: "+caps);
GLWindow glWindow = GLWindow.create(caps);
- setContentView(glWindow);
+ glWindow.setFullscreen(true);
+ setContentView(getWindow(), glWindow);
glWindow.addGLEventListener(new GearsES2(1));
glWindow.getWindow().getScreen().addScreenModeListener(new ScreenModeListener() {
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivity.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivity.java
new file mode 100644
index 000000000..84ff0a5a7
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivity.java
@@ -0,0 +1,77 @@
+/**
+ * Copyright 2011 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+package com.jogamp.opengl.test.android;
+
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLProfile;
+
+import jogamp.newt.driver.android.NewtBaseActivity;
+
+import com.jogamp.newt.ScreenMode;
+import com.jogamp.newt.event.ScreenModeListener;
+import com.jogamp.newt.opengl.GLWindow;
+
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.util.Animator;
+
+import android.os.Bundle;
+import android.util.Log;
+
+public class NEWTGearsES2TransActivity extends NewtBaseActivity {
+ static String TAG = "NEWTGearsES2TransActivity";
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ Log.d(TAG, "onCreate - 0");
+ super.onCreate(savedInstanceState);
+
+ // 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);
+ glWindow.setUndecorated(true);
+ setContentView(getWindow(), glWindow);
+
+ glWindow.addGLEventListener(new GearsES2(1));
+ glWindow.getWindow().getScreen().addScreenModeListener(new ScreenModeListener() {
+ public void screenModeChangeNotify(ScreenMode sm) { }
+ public void screenModeChanged(ScreenMode sm, boolean success) {
+ System.err.println("ScreenMode Changed: "+sm);
+ }
+ });
+ glWindow.setVisible(true);
+ Animator animator = new Animator(glWindow);
+ animator.setUpdateFPSFrames(60, System.err);
+ setAnimator(animator);
+
+ 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 99de90f2a..83f35879b 100644
--- a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivity.java
+++ b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI1pActivity.java
@@ -57,7 +57,8 @@ public class NEWTGraphUI1pActivity extends NewtBaseActivity {
caps.setSampleBuffers(true);
Log.d(TAG, "req caps: "+caps);
GLWindow glWindow = GLWindow.create(caps);
- setContentView(glWindow);
+ glWindow.setFullscreen(true);
+ setContentView(getWindow(), glWindow);
glWindow.addGLEventListener(new GPUUISceneGLListener0A(0));
glWindow.getWindow().getScreen().addScreenModeListener(new ScreenModeListener() {
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivity.java b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivity.java
index c627ce725..17924d43d 100644
--- a/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivity.java
+++ b/src/test/com/jogamp/opengl/test/android/NEWTGraphUI2pActivity.java
@@ -58,7 +58,8 @@ public class NEWTGraphUI2pActivity extends NewtBaseActivity {
caps.setSampleBuffers(true);
Log.d(TAG, "req caps: "+caps);
GLWindow glWindow = GLWindow.create(caps);
- setContentView(glWindow);
+ glWindow.setFullscreen(true);
+ setContentView(getWindow(), glWindow);
glWindow.addGLEventListener(new GPUUISceneGLListener0A(Region.VBAA_RENDERING_BIT));
glWindow.getWindow().getScreen().addScreenModeListener(new ScreenModeListener() {
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1Activity.java b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1Activity.java
index bf5fcce49..6fc3a46d6 100644
--- a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1Activity.java
+++ b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES1Activity.java
@@ -54,7 +54,7 @@ public class NEWTRedSquareES1Activity extends NewtBaseActivity {
GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES1));
Log.d(TAG, "req caps: "+caps);
GLWindow glWindow = GLWindow.create(caps);
- setContentView(glWindow);
+ setContentView(getWindow(), glWindow);
glWindow.addGLEventListener(new RedSquareES1(1));
glWindow.getWindow().getScreen().addScreenModeListener(new ScreenModeListener() {
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2Activity.java b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2Activity.java
index fcffc5244..e9ef981b8 100644
--- a/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2Activity.java
+++ b/src/test/com/jogamp/opengl/test/android/NEWTRedSquareES2Activity.java
@@ -54,7 +54,8 @@ public class NEWTRedSquareES2Activity extends NewtBaseActivity {
GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2));
Log.d(TAG, "req caps: "+caps);
GLWindow glWindow = GLWindow.create(caps);
- setContentView(glWindow);
+ glWindow.setFullscreen(true);
+ setContentView(getWindow(), glWindow);
glWindow.addGLEventListener(new RedSquareES2(1));
glWindow.getWindow().getScreen().addScreenModeListener(new ScreenModeListener() {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java
index 0484b6a77..8d1c708af 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java
@@ -71,6 +71,12 @@ public class RedSquareES1 implements GLEventListener {
} catch (Exception e) {e.printStackTrace();}
}
+ System.err.println(Thread.currentThread()+"Chosen GLCapabilities: " + drawable.getChosenGLCapabilities());
+ System.err.println(Thread.currentThread()+"INIT GL IS: " + gl.getClass().getName());
+ System.err.println(Thread.currentThread()+"GL_VENDOR: " + gl.glGetString(GL.GL_VENDOR));
+ System.err.println(Thread.currentThread()+"GL_RENDERER: " + gl.glGetString(GL.GL_RENDERER));
+ System.err.println(Thread.currentThread()+"GL_VERSION: " + gl.glGetString(GL.GL_VERSION));
+
System.err.println(Thread.currentThread()+" GL Profile: "+gl.getGLProfile());
System.err.println(Thread.currentThread()+" GL:" + gl);
System.err.println(Thread.currentThread()+" GL_VERSION=" + gl.glGetString(GL.GL_VERSION));
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 d0eb3b183..9bff38fce 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
@@ -56,7 +56,9 @@ public class GearsES2 implements GLEventListener {
private GearsObjectES2 gear1=null, gear2=null, gear3=null;
private float angle = 0.0f;
private int swapInterval = 0;
- private boolean initialized = false;
+ // private MouseListener gearsMouse = new TraceMouseAdapter(new GearsMouseAdapter());
+ private MouseListener gearsMouse = new GearsMouseAdapter();
+ private KeyListener gearsKeys = new GearsKeyAdapter();
private int prevMouseX, prevMouseY;
@@ -92,7 +94,6 @@ public class GearsES2 implements GLEventListener {
public void init(GLAutoDrawable drawable) {
System.err.println(Thread.currentThread()+" GearsES2.init ...");
- initialized = true;
GL2ES2 gl = drawable.getGL().getGL2ES2();
System.err.println("Chosen GLCapabilities: " + drawable.getChosenGLCapabilities());
@@ -156,10 +157,6 @@ public class GearsES2 implements GLEventListener {
System.err.println("gear3 reused: "+gear3);
}
- // MouseListener gearsMouse = new TraceMouseAdapter(new GearsMouseAdapter());
- MouseListener gearsMouse = new GearsMouseAdapter();
- KeyListener gearsKeys = new GearsKeyAdapter();
-
if (drawable instanceof Window) {
Window window = (Window) drawable;
window.addMouseListener(gearsMouse);
@@ -197,7 +194,11 @@ public class GearsES2 implements GLEventListener {
public void dispose(GLAutoDrawable drawable) {
System.err.println(Thread.currentThread()+" GearsES2.dispose ... ");
- initialized = false;
+ if (drawable instanceof Window) {
+ Window window = (Window) drawable;
+ window.removeMouseListener(gearsMouse);
+ window.removeKeyListener(gearsKeys);
+ }
GL2ES2 gl = drawable.getGL().getGL2ES2();
st.useProgram(gl, false);
gear1.destroy(gl);
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 81c97d861..d06c6da97 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
@@ -27,6 +27,9 @@
*/
package com.jogamp.opengl.test.junit.jogl.demos.es2;
+import com.jogamp.newt.event.MouseAdapter;
+import com.jogamp.newt.event.MouseEvent;
+import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.util.GLArrayDataServer;
import com.jogamp.opengl.util.PMVMatrix;
import com.jogamp.opengl.util.glsl.ShaderCode;
@@ -34,8 +37,10 @@ import com.jogamp.opengl.util.glsl.ShaderProgram;
import com.jogamp.opengl.util.glsl.ShaderState;
import javax.media.opengl.GL;
import javax.media.opengl.GL2ES2;
+import javax.media.opengl.GLAnimatorControl;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
+import javax.media.opengl.GLRunnable;
import javax.media.opengl.GLUniformData;
public class RedSquareES2 implements GLEventListener {
@@ -46,6 +51,8 @@ public class RedSquareES2 implements GLEventListener {
GLArrayDataServer colors ;
long t0;
private int swapInterval = 0;
+ MyMouseAdapter myMouse = new MyMouseAdapter();
+ GLWindow glWindow = null;
public RedSquareES2(int swapInterval) {
this.swapInterval = swapInterval;
@@ -64,7 +71,6 @@ public class RedSquareES2 implements GLEventListener {
System.err.println(Thread.currentThread()+"GL_VENDOR: " + gl.glGetString(GL.GL_VENDOR));
System.err.println(Thread.currentThread()+"GL_RENDERER: " + gl.glGetString(GL.GL_RENDERER));
System.err.println(Thread.currentThread()+"GL_VERSION: " + gl.glGetString(GL.GL_VERSION));
-
System.err.println(Thread.currentThread()+" GL Profile: "+gl.getGLProfile());
System.err.println(Thread.currentThread()+" GL:" + gl);
@@ -104,8 +110,8 @@ public class RedSquareES2 implements GLEventListener {
// Allocate Color Array
colors= GLArrayDataServer.createGLSL("mgl_Color", 4, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW);
- colors.putf(1); colors.putf(0); colors.putf(0); colors.putf(1);
- colors.putf(0); colors.putf(0); colors.putf(1); colors.putf(1);
+ colors.putf(1); colors.putf(0); colors.putf(0); colors.putf(1);
+ colors.putf(0); colors.putf(0); colors.putf(1); colors.putf(1);
colors.putf(1); colors.putf(0); colors.putf(0); colors.putf(1);
colors.putf(1); colors.putf(0); colors.putf(0); colors.putf(1);
colors.seal(gl, true);
@@ -117,6 +123,10 @@ public class RedSquareES2 implements GLEventListener {
gl.glEnable(GL2ES2.GL_DEPTH_TEST);
st.useProgram(gl, false);
+ if (glad instanceof GLWindow) {
+ glWindow = (GLWindow) glad;
+ glWindow.addMouseListener(myMouse);
+ }
t0 = System.currentTimeMillis();
System.err.println(Thread.currentThread()+" RedSquareES2.init FIN");
}
@@ -124,7 +134,6 @@ public class RedSquareES2 implements GLEventListener {
public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) {
System.err.println(Thread.currentThread()+" RedSquareES2.reshape "+x+"/"+y+" "+width+"x"+height+", swapInterval "+swapInterval);
GL2ES2 gl = glad.getGL().getGL2ES2();
- gl.setSwapInterval(swapInterval);
st.useProgram(gl, true);
// Set location in front of camera
@@ -132,7 +141,7 @@ public class RedSquareES2 implements GLEventListener {
pmvMatrix.glLoadIdentity();
pmvMatrix.gluPerspective(45.0F, (float) width / (float) height, 1.0F, 100.0F);
//pmvMatrix.glOrthof(-4.0f, 4.0f, -4.0f, 4.0f, 1.0f, 100.0f);
- gl.glUniform(pmvMatrixUniform);
+ st.uniform(gl, pmvMatrixUniform);
st.useProgram(gl, false);
System.err.println(Thread.currentThread()+" RedSquareES2.reshape FIN");
}
@@ -141,8 +150,8 @@ public class RedSquareES2 implements GLEventListener {
long t1 = System.currentTimeMillis();
GL2ES2 gl = glad.getGL().getGL2ES2();
- st.useProgram(gl, true);
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
+ st.useProgram(gl, true);
// One rotation every four seconds
pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
@@ -150,7 +159,8 @@ public class RedSquareES2 implements GLEventListener {
float ang = ((float) (t1 - t0) * 360.0F) / 4000.0F;
pmvMatrix.glRotatef(ang, 0, 0, 1);
pmvMatrix.glRotatef(ang, 0, 1, 0);
- gl.glUniform(pmvMatrixUniform);
+ st.uniform(gl, pmvMatrixUniform);
+
// Draw a square
vertices.enableBuffer(gl, true);
colors.enableBuffer(gl, true);
@@ -162,6 +172,10 @@ public class RedSquareES2 implements GLEventListener {
public void dispose(GLAutoDrawable glad) {
System.err.println(Thread.currentThread()+" RedSquareES2.dispose ... ");
+ if (null != glWindow) {
+ glWindow.removeMouseListener(myMouse);
+ glWindow = null;
+ }
GL2ES2 gl = glad.getGL().getGL2ES2();
st.destroy(gl);
st = null;
@@ -169,4 +183,29 @@ public class RedSquareES2 implements GLEventListener {
pmvMatrix = null;
System.err.println(Thread.currentThread()+" RedSquareES2.dispose FIN");
}
+
+ class MyMouseAdapter extends MouseAdapter {
+ public void mouseClicked(MouseEvent e) {
+ System.err.println(e);
+ if(null != glWindow && e.getSource() == glWindow.getWindow()) {
+ if(e.getX() < glWindow.getWidth()/2) {
+ glWindow.setFullscreen(!glWindow.isFullscreen());
+ System.err.println("setFullscreen: "+glWindow.isFullscreen());
+ } else {
+ glWindow.invoke(false, new GLRunnable() {
+ public boolean run(GLAutoDrawable drawable) {
+ GL gl = drawable.getGL();
+ gl.setSwapInterval(gl.getSwapInterval()<=0?1:0);
+ System.err.println("setSwapInterval: "+gl.getSwapInterval());
+ final GLAnimatorControl a = drawable.getAnimator();
+ if( null != a ) {
+ a.resetFPSCounter();
+ }
+ return true;
+ }
+ });
+ }
+ }
+ }
+ }
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java
index b83bdb45d..63ec215fc 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java
@@ -103,7 +103,7 @@ public class TestRedSquareES2NEWT extends UITestCase {
glWindow.setSize(width, height);
glWindow.setVisible(true);
- animator.setUpdateFPSFrames(1, null);
+ animator.setUpdateFPSFrames(60, System.err);
animator.start();
while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) {