aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRami Santina <[email protected]>2011-09-30 19:58:01 +0300
committerRami Santina <[email protected]>2011-09-30 19:58:01 +0300
commit836d4824ad20c57155d850d2b3657004b019514d (patch)
tree7e3065788ee7959877589f4e19172f5044b0ca58
parent14ec84659f2ef5ba6c74601360adfff0558fc6f0 (diff)
parent448ad05ea1192a1c3ca8812bf8d3142b2df6c30b (diff)
Merge branch 'android-tegra-playground' of git://github.com/sgothel/jogl into android-tegra-playground
-rw-r--r--make/resources/android/AndroidManifest-launcher.xml24
-rw-r--r--make/resources/android/res-launcher/values/strings.xml4
-rwxr-xr-xmake/scripts/adb-reinstall-all.sh4
-rw-r--r--src/android/com/jogamp/android/launcher/ClassLoaderUtil.java87
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java28
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java49
-rw-r--r--src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java36
-rw-r--r--src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java36
-rw-r--r--src/test/com/jogamp/opengl/test/android/NEWTGraphUIActivity.java36
-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/RedSquareES2.java20
11 files changed, 121 insertions, 209 deletions
diff --git a/make/resources/android/AndroidManifest-launcher.xml b/make/resources/android/AndroidManifest-launcher.xml
index d32695fb6..c77addb2e 100644
--- a/make/resources/android/AndroidManifest-launcher.xml
+++ b/make/resources/android/AndroidManifest-launcher.xml
@@ -13,6 +13,30 @@
android:description="@string/app_descr"
android:persistent="false"
>
+ <activity android:name="com.jogamp.android.launcher.NEWTLauncherRedSquareES1Activity"
+ android:finishOnTaskLaunch="true"
+ android:launchMode="standard"
+ android:configChanges="keyboardHidden|orientation"
+ android:label="@string/activity_redsquarees1_name"
+ android:description="@string/activity_redsquarees1_descr"
+ >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity android:name="com.jogamp.android.launcher.NEWTLauncherRedSquareES2Activity"
+ android:finishOnTaskLaunch="true"
+ android:launchMode="standard"
+ android:configChanges="keyboardHidden|orientation"
+ android:label="@string/activity_redsquarees2_name"
+ android:description="@string/activity_redsquarees2_descr"
+ >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
<activity android:name="com.jogamp.android.launcher.NEWTLauncherGearsES1Activity"
android:finishOnTaskLaunch="true"
android:launchMode="standard"
diff --git a/make/resources/android/res-launcher/values/strings.xml b/make/resources/android/res-launcher/values/strings.xml
index 595752728..c039d6864 100644
--- a/make/resources/android/res-launcher/values/strings.xml
+++ b/make/resources/android/res-launcher/values/strings.xml
@@ -3,6 +3,10 @@
<string name="hello">Jogl Launcher</string>
<string name="app_name">JogAmp\'s Jogl Launcher</string>
<string name="app_descr">Launches Jogl Applications.</string>
+ <string name="activity_redsquarees1_name">RedSquareES1</string>
+ <string name="activity_redsquarees1_descr">RedSquareES1</string>
+ <string name="activity_redsquarees2_name">RedSquareES2</string>
+ <string name="activity_redsquarees2_descr">RedSquareES2</string>
<string name="activity_gearses1_name">GearsES1</string>
<string name="activity_gearses1_descr">GearsES1</string>
<string name="activity_gearses2_name">GearsES2</string>
diff --git a/make/scripts/adb-reinstall-all.sh b/make/scripts/adb-reinstall-all.sh
new file mode 100755
index 000000000..dcbd1c861
--- /dev/null
+++ b/make/scripts/adb-reinstall-all.sh
@@ -0,0 +1,4 @@
+sdir=`dirname $0`
+
+$sdir/adb-uninstall-all.sh
+$sdir/adb-install-all.sh
diff --git a/src/android/com/jogamp/android/launcher/ClassLoaderUtil.java b/src/android/com/jogamp/android/launcher/ClassLoaderUtil.java
index 36f4c333f..4f0bf46b8 100644
--- a/src/android/com/jogamp/android/launcher/ClassLoaderUtil.java
+++ b/src/android/com/jogamp/android/launcher/ClassLoaderUtil.java
@@ -43,54 +43,75 @@ public class ClassLoaderUtil {
public static final String dexPathName= "jogampDex";
- // private static LauncherTempFileCache tmpFileCache;
-
+ private static LauncherTempFileCache tmpFileCache = null;
+ private static ClassLoader jogAmpClassLoader = null;
+
public static synchronized ClassLoader createJogampClassLoaderSingleton(Context ctx, String userPackageName) {
- LauncherTempFileCache tmpFileCache = null; // hack .. for each launch, instead for each ClassLoader
- if(null==tmpFileCache) {
- if(!LauncherTempFileCache.initSingleton(ctx)) {
- throw new InternalError("TempFileCache initialization error");
- }
+ if(null==jogAmpClassLoader) {
+ if(null!=tmpFileCache) {
+ throw new InternalError("XXX0");
+ }
+ if(!LauncherTempFileCache.initSingleton(ctx)) {
+ throw new InternalError("TempFileCache initialization error");
+ }
tmpFileCache = new LauncherTempFileCache();
if(!tmpFileCache.isValid()) {
throw new InternalError("TempFileCache instantiation error");
}
- }
- final ApplicationInfo ai = ctx.getApplicationInfo();
- Log.d(TAG, "S: userPackageName: "+userPackageName+", dataDir: "+ai.dataDir+", nativeLibraryDir: "+ai.nativeLibraryDir);
-
- final String appDir = new File(ai.dataDir).getParent();
- final String libSub = ai.nativeLibraryDir.substring(ai.nativeLibraryDir.lastIndexOf('/')+1);
- Log.d(TAG, "S: appDir: "+appDir+", libSub: "+libSub);
+ final ApplicationInfo ai = ctx.getApplicationInfo();
+ Log.d(TAG, "S: userPackageName: "+userPackageName+", dataDir: "+ai.dataDir+", nativeLibraryDir: "+ai.nativeLibraryDir);
+
+ final String appDir = new File(ai.dataDir).getParent();
+ final String libSub = ai.nativeLibraryDir.substring(ai.nativeLibraryDir.lastIndexOf('/')+1);
+ Log.d(TAG, "S: appDir: "+appDir+", libSub: "+libSub);
+
+ final String libPathName = appDir + "/" + packageGlueGen + "/" + libSub + "/:" +
+ appDir + "/" + packageJogl + "/" + libSub + "/" ;
+ Log.d(TAG, "S: libPath: "+libPathName);
+
+ String apkGlueGen = null;
+ String apkJogl = null;
- final String libPathName = appDir + "/" + packageGlueGen + "/" + libSub + "/:" +
- appDir + "/" + packageJogl + "/" + libSub + "/" ;
- Log.d(TAG, "S: libPath: "+libPathName);
-
- String apkGlueGen = null;
- String apkJogl = null;
- String apkJoglTest = null;
+ try {
+ apkGlueGen = ctx.getPackageManager().getApplicationInfo(packageGlueGen,0).sourceDir;
+ apkJogl = ctx.getPackageManager().getApplicationInfo(packageJogl,0).sourceDir;
+ } catch (PackageManager.NameNotFoundException e) {
+ Log.d(TAG, "error: "+e, e);
+ }
+ if(null == apkGlueGen || null == apkJogl) {
+ Log.d(TAG, "not found: gluegen <"+apkGlueGen+">, jogl <"+apkJogl+">");
+ return null;
+ }
+
+ final String cp = apkGlueGen + ":" + apkJogl ;
+ Log.d(TAG, "jogamp cp: " + cp);
+
+ final File dexPath = new File(tmpFileCache.getTempDir(), dexPathName);
+ Log.d(TAG, "jogamp dexPath: " + dexPath.getAbsolutePath());
+ dexPath.mkdir();
+ jogAmpClassLoader = new DexClassLoader(cp, dexPath.getAbsolutePath(), libPathName, ctx.getClassLoader());
+ } else {
+ if(null==tmpFileCache) {
+ throw new InternalError("XXX1");
+ }
+ }
+ String apkUser = null;
try {
- apkGlueGen = ctx.getPackageManager().getApplicationInfo(packageGlueGen,0).sourceDir;
- apkJogl = ctx.getPackageManager().getApplicationInfo(packageJogl,0).sourceDir;
- apkJoglTest = ctx.getPackageManager().getApplicationInfo(userPackageName,0).sourceDir;
+ apkUser = ctx.getPackageManager().getApplicationInfo(userPackageName,0).sourceDir;
} catch (PackageManager.NameNotFoundException e) {
Log.d(TAG, "error: "+e, e);
}
- if(null == apkGlueGen || null == apkJogl || null == apkJoglTest) {
- Log.d(TAG, "not found: gluegen <"+apkGlueGen+">, jogl <"+apkJogl+">, jogl-test <"+apkJoglTest+">");
+ if(null == apkUser) {
+ Log.d(TAG, "not found: user apk <"+apkUser+">");
return null;
}
- final String cp = apkGlueGen + ":" + apkJogl + ":" + apkJoglTest ;
- Log.d(TAG, "cp: " + cp);
-
- final File dexPath = new File(tmpFileCache.getTempDir(), dexPathName);
- Log.d(TAG, "dexPath: " + dexPath.getAbsolutePath());
+ Log.d(TAG, "user cp: " + apkUser);
+ final File dexPath = new File(tmpFileCache.getTempDir(), userPackageName);
+ Log.d(TAG, "user dexPath: " + dexPath.getAbsolutePath());
dexPath.mkdir();
-
- ClassLoader cl = new DexClassLoader(cp, dexPath.getAbsolutePath(), libPathName, ctx.getClassLoader());
+ ClassLoader cl = new DexClassLoader(apkUser, dexPath.getAbsolutePath(), null, jogAmpClassLoader);
Log.d(TAG, "cl: " + cl);
// setAPKClassLoader(dexLoader);
diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java b/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java
index 358fcc994..9a2a0ea2c 100644
--- a/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java
+++ b/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java
@@ -31,15 +31,18 @@ import javax.media.opengl.GLProfile;
import com.jogamp.newt.Window;
import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.opengl.util.Animator;
import jogamp.newt.driver.android.AndroidWindow;
import android.app.Activity;
-import android.content.Context;
import android.os.Bundle;
import android.util.Log;
public class NewtBaseActivity extends Activity {
+ AndroidWindow window = null;
+ Animator animator = null;
+
boolean isInvokedByExternalActivity = false;
Activity extActivity = this;
@@ -56,16 +59,21 @@ public class NewtBaseActivity extends Activity {
window = ((GLWindow)window).getWindow();
}
if(window instanceof AndroidWindow) {
+ this.window = (AndroidWindow)window;
if(isInvokedByExternalActivity) {
- extActivity.setContentView(((AndroidWindow)window).getView());
+ extActivity.setContentView(this.window.getView());
} else {
- super.setContentView(((AndroidWindow)window).getView());
+ super.setContentView(this.window.getView());
}
} else {
throw new IllegalArgumentException("Given NEWT Window is not an Android Window: "+window.getClass());
}
}
+ public void setAnimator(Animator animator) {
+ this.animator = animator;
+ }
+
@Override
public void onCreate(Bundle savedInstanceState) {
Log.d(MD.TAG, "onCreate");
@@ -103,11 +111,17 @@ public class NewtBaseActivity extends Activity {
if(!isInvokedByExternalActivity) {
super.onResume();
}
+ if(null != animator) {
+ animator.start();
+ }
}
@Override
public void onPause() {
Log.d(MD.TAG, "onPause");
+ if(null != animator) {
+ animator.pause();
+ }
if(!isInvokedByExternalActivity) {
super.onPause();
}
@@ -124,6 +138,14 @@ public class NewtBaseActivity extends Activity {
@Override
public void onDestroy() {
Log.d(MD.TAG, "onDestroy");
+ if(null != animator) {
+ animator.stop();
+ animator = null;
+ }
+ if(null != window) {
+ window.destroy();
+ window = null;
+ }
if(!isInvokedByExternalActivity) {
super.onDestroy();
}
diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java
index 5842a285d..d37901793 100644
--- a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java
+++ b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java
@@ -30,17 +30,13 @@ package jogamp.newt.driver.android;
import com.jogamp.common.GlueGenVersion;
import com.jogamp.common.os.Platform;
import com.jogamp.common.util.VersionUtil;
-import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.JoglVersion;
-import com.jogamp.opengl.util.Animator;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
public class NewtVersionActivity extends NewtBaseActivity {
- GLWindow glWindow = null;
- Animator animator = null;
TextView tv = null;
@Override
@@ -57,50 +53,7 @@ public class NewtVersionActivity extends NewtBaseActivity {
tv = new TextView(this);
tv.setText(VersionUtil.getPlatformInfo()+Platform.NEWLINE+GlueGenVersion.getInstance()+Platform.NEWLINE+JoglVersion.getInstance()+Platform.NEWLINE);
setContentView(tv);
- /**
- // create GLWindow (-> incl. underlying NEWT Display, Screen & Window)
- GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES1));
- glWindow = GLWindow.create(caps);
- setContentView(glWindow);
-
- glWindow.addGLEventListener(new GearsES1(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 = new Animator(glWindow);
- animator.setUpdateFPSFrames(60, System.err); */
-
- Log.d(MD.TAG, "onCreate - X");
- }
-
- @Override
- public void onResume() {
- super.onResume();
- if(null != animator) {
- animator.start();
- }
- }
- @Override
- public void onPause() {
- super.onPause();
- if(null != animator) {
- animator.pause();
- }
- }
-
- @Override
- public void onDestroy() {
- super.onDestroy();
- if(null != animator) {
- animator.stop();
- }
- if(null != glWindow) {
- glWindow.destroy();
- }
+ Log.d(MD.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 c0b358d07..897df89cd 100644
--- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java
+++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java
@@ -41,12 +41,8 @@ import com.jogamp.opengl.util.Animator;
import android.os.Bundle;
import android.util.Log;
-import android.widget.TextView;
public class NEWTGearsES1Activity extends NewtBaseActivity {
- GLWindow glWindow = null;
- Animator animator = null;
- TextView tv = null;
static String TAG = "NEWTGearsES1Activity";
@Override
@@ -57,7 +53,7 @@ public class NEWTGearsES1Activity extends NewtBaseActivity {
// create GLWindow (-> incl. underlying NEWT Display, Screen & Window)
GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES1));
Log.d(TAG, "req caps: "+caps);
- glWindow = GLWindow.create(caps);
+ GLWindow glWindow = GLWindow.create(caps);
setContentView(glWindow);
glWindow.addGLEventListener(new GearsES1(1));
@@ -68,36 +64,10 @@ public class NEWTGearsES1Activity extends NewtBaseActivity {
}
});
glWindow.setVisible(true);
- animator = new Animator(glWindow);
+ Animator animator = new Animator(glWindow);
animator.setUpdateFPSFrames(60, System.err);
+ setAnimator(animator);
Log.d(TAG, "onCreate - X");
- }
-
- @Override
- public void onResume() {
- super.onResume();
- if(null != animator) {
- animator.start();
- }
- }
-
- @Override
- public void onPause() {
- if(null != animator) {
- animator.pause();
- }
- super.onPause();
- }
-
- @Override
- public void onDestroy() {
- if(null != animator) {
- animator.stop();
- }
- if(null != glWindow) {
- glWindow.destroy();
- }
- super.onDestroy();
}
}
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java
index 12ef40280..b19c12d4a 100644
--- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java
+++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java
@@ -41,12 +41,8 @@ import com.jogamp.opengl.util.Animator;
import android.os.Bundle;
import android.util.Log;
-import android.widget.TextView;
public class NEWTGearsES2Activity extends NewtBaseActivity {
- GLWindow glWindow = null;
- Animator animator = null;
- TextView tv = null;
static String TAG = "NEWTGearsES2Activity";
@Override
@@ -57,7 +53,7 @@ public class NEWTGearsES2Activity extends NewtBaseActivity {
// create GLWindow (-> incl. underlying NEWT Display, Screen & Window)
GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2));
Log.d(TAG, "req caps: "+caps);
- glWindow = GLWindow.create(caps);
+ GLWindow glWindow = GLWindow.create(caps);
setContentView(glWindow);
glWindow.addGLEventListener(new GearsES2(1));
@@ -68,36 +64,10 @@ public class NEWTGearsES2Activity extends NewtBaseActivity {
}
});
glWindow.setVisible(true);
- animator = new Animator(glWindow);
+ Animator animator = new Animator(glWindow);
animator.setUpdateFPSFrames(60, System.err);
+ setAnimator(animator);
Log.d(TAG, "onCreate - X");
- }
-
- @Override
- public void onResume() {
- super.onResume();
- if(null != animator) {
- animator.start();
- }
- }
-
- @Override
- public void onPause() {
- super.onPause();
- if(null != animator) {
- animator.pause();
- }
- }
-
- @Override
- public void onDestroy() {
- super.onDestroy();
- if(null != animator) {
- animator.stop();
- }
- if(null != glWindow) {
- glWindow.destroy();
- }
}
}
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGraphUIActivity.java b/src/test/com/jogamp/opengl/test/android/NEWTGraphUIActivity.java
index d6ab28f13..3fcc82689 100644
--- a/src/test/com/jogamp/opengl/test/android/NEWTGraphUIActivity.java
+++ b/src/test/com/jogamp/opengl/test/android/NEWTGraphUIActivity.java
@@ -41,12 +41,8 @@ import com.jogamp.opengl.util.Animator;
import android.os.Bundle;
import android.util.Log;
-import android.widget.TextView;
public class NEWTGraphUIActivity extends NewtBaseActivity {
- GLWindow glWindow = null;
- Animator animator = null;
- TextView tv = null;
static String TAG = "NEWTGraphUIActivity";
@Override
@@ -60,7 +56,7 @@ public class NEWTGraphUIActivity extends NewtBaseActivity {
caps.setNumSamples(4);
caps.setSampleBuffers(true);
Log.d(TAG, "req caps: "+caps);
- glWindow = GLWindow.create(caps);
+ GLWindow glWindow = GLWindow.create(caps);
setContentView(glWindow);
glWindow.addGLEventListener(new GPUUISceneGLListener0A());
@@ -71,36 +67,10 @@ public class NEWTGraphUIActivity extends NewtBaseActivity {
}
});
glWindow.setVisible(true);
- animator = new Animator(glWindow);
+ Animator animator = new Animator(glWindow);
animator.setUpdateFPSFrames(60, System.err);
+ setAnimator(animator);
Log.d(TAG, "onCreate - X");
- }
-
- @Override
- public void onResume() {
- super.onResume();
- if(null != animator) {
- animator.start();
- }
- }
-
- @Override
- public void onPause() {
- super.onPause();
- if(null != animator) {
- animator.pause();
- }
- }
-
- @Override
- public void onDestroy() {
- super.onDestroy();
- if(null != animator) {
- animator.stop();
- }
- if(null != glWindow) {
- glWindow.destroy();
- }
}
}
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 cc2578e9d..38afec7f1 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
@@ -7,8 +7,6 @@ import javax.media.opengl.fixedfunc.GLMatrixFunc;
import javax.media.opengl.fixedfunc.GLPointerFunc;
import javax.media.opengl.glu.*;
-import org.junit.Assert;
-
import com.jogamp.opengl.util.glsl.fixedfunc.*;
public class RedSquareES1 implements GLEventListener {
@@ -45,7 +43,6 @@ public class RedSquareES1 implements GLEventListener {
public void init(GLAutoDrawable drawable) {
System.err.println(Thread.currentThread()+" RedSquareES1.init ...");
- Assert.assertNull("GLU object is not null -> already init", glu);
GL _gl = drawable.getGL();
if(glDebugEmu) {
@@ -111,7 +108,6 @@ public class RedSquareES1 implements GLEventListener {
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
System.err.println(Thread.currentThread()+" RedSquareES1.reshape "+x+"/"+y+" "+width+"x"+height+", swapInterval "+swapInterval);
- Assert.assertNotNull("GLU object is null -> not init or already disposed", glu);
GL2ES1 gl = drawable.getGL().getGL2ES1();
gl.setSwapInterval(swapInterval);
@@ -125,7 +121,6 @@ public class RedSquareES1 implements GLEventListener {
}
public void display(GLAutoDrawable drawable) {
- Assert.assertNotNull("GLU object is null -> not init or already disposed", glu);
curTime = System.currentTimeMillis();
GL2ES1 gl = drawable.getGL().getGL2ES1();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
@@ -148,7 +143,6 @@ public class RedSquareES1 implements GLEventListener {
public void dispose(GLAutoDrawable drawable) {
System.err.println(Thread.currentThread()+" RedSquareES1.dispose ... ");
- Assert.assertNotNull("GLU object is null -> not init or already disposed", glu);
GL2ES1 gl = drawable.getGL().getGL2ES1();
gl.glDisableClientState(GLPointerFunc.GL_VERTEX_ARRAY);
gl.glDisableClientState(GLPointerFunc.GL_COLOR_ARRAY);
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 c3dfb8897..b750e8eb1 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
@@ -36,9 +36,7 @@ import javax.media.opengl.GL;
import javax.media.opengl.GL2ES2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
-import javax.media.opengl.GLException;
import javax.media.opengl.GLUniformData;
-import org.junit.Assert;
public class RedSquareES2 implements GLEventListener {
ShaderState st;
@@ -59,7 +57,6 @@ public class RedSquareES2 implements GLEventListener {
public void init(GLAutoDrawable glad) {
System.err.println(Thread.currentThread()+" RedSquareES2.init ...");
- Assert.assertNull("ShaderState object is not null -> already init", st);
GL2ES2 gl = glad.getGL().getGL2ES2();
System.err.println(Thread.currentThread()+" GL Profile: "+gl.getGLProfile());
@@ -77,7 +74,6 @@ public class RedSquareES2 implements GLEventListener {
sp0.add(gl, fp0, System.err);
st.attachShaderProgram(gl, sp0);
st.useProgram(gl, true);
- Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
// setup mgl_PMVMatrix
pmvMatrix = new PMVMatrix();
@@ -88,7 +84,6 @@ public class RedSquareES2 implements GLEventListener {
pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); // P, Mv
st.ownUniform(pmvMatrixUniform);
st.uniform(gl, pmvMatrixUniform);
- Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
// Allocate Vertex Array
vertices = GLArrayDataServer.createGLSL("mgl_Vertex", 3, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW);
@@ -99,7 +94,6 @@ public class RedSquareES2 implements GLEventListener {
vertices.seal(gl, true);
st.ownAttribute(vertices, true);
vertices.enableBuffer(gl, false);
- Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
// Allocate Color Array
colors= GLArrayDataServer.createGLSL("mgl_Color", 4, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW);
@@ -110,13 +104,11 @@ public class RedSquareES2 implements GLEventListener {
colors.seal(gl, true);
st.ownAttribute(colors, true);
colors.enableBuffer(gl, false);
- Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
// OpenGL Render Settings
gl.glClearColor(0, 0, 0, 1);
gl.glEnable(GL2ES2.GL_DEPTH_TEST);
st.useProgram(gl, false);
- Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
t0 = System.currentTimeMillis();
System.err.println(Thread.currentThread()+" RedSquareES2.init FIN");
@@ -124,33 +116,26 @@ 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);
- Assert.assertNotNull("ShaderState object is null -> not init or already disposed", st);
GL2ES2 gl = glad.getGL().getGL2ES2();
gl.setSwapInterval(swapInterval);
st.useProgram(gl, true);
- Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
// Set location in front of camera
pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION);
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);
- Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
st.useProgram(gl, false);
- Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
System.err.println(Thread.currentThread()+" RedSquareES2.reshape FIN");
}
public void display(GLAutoDrawable glad) {
- Assert.assertNotNull("ShaderState object is null -> not init or already disposed", st);
long t1 = System.currentTimeMillis();
GL2ES2 gl = glad.getGL().getGL2ES2();
st.useProgram(gl, true);
- Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
- Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
// One rotation every four seconds
pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
@@ -159,24 +144,19 @@ public class RedSquareES2 implements GLEventListener {
pmvMatrix.glRotatef(ang, 0, 0, 1);
pmvMatrix.glRotatef(ang, 0, 1, 0);
gl.glUniform(pmvMatrixUniform);
- Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
// Draw a square
vertices.enableBuffer(gl, true);
colors.enableBuffer(gl, true);
gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4);
vertices.enableBuffer(gl, false);
colors.enableBuffer(gl, false);
- Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
st.useProgram(gl, false);
- Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
}
public void dispose(GLAutoDrawable glad) {
System.err.println(Thread.currentThread()+" RedSquareES2.dispose ... ");
- Assert.assertNotNull("ShaderState object is null -> not init or already disposed", st);
GL2ES2 gl = glad.getGL().getGL2ES2();
st.destroy(gl);
- Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError());
st = null;
pmvMatrix.destroy();
pmvMatrix = null;