aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--make/build.xml43
-rw-r--r--make/resources/android/AndroidManifest-launcher.xml25
-rw-r--r--make/resources/android/res-launcher/values/strings.xml10
-rwxr-xr-xmake/scripts/tests.sh12
-rw-r--r--src/android/com/jogamp/android/launcher/ClassLoaderUtil.java17
-rw-r--r--src/android/com/jogamp/android/launcher/NEWTLauncherActivity.java229
-rw-r--r--src/android/com/jogamp/android/launcher/NEWTLauncherGearsES1Activity.java11
-rw-r--r--src/android/com/jogamp/android/launcher/NEWTLauncherGearsES2Activity.java11
-rw-r--r--src/android/com/jogamp/android/launcher/NEWTLauncherGraphUIActivity.java11
-rw-r--r--src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java (renamed from src/android/com/jogamp/android/launcher/NEWTLauncherGearsActivity.java)0
-rw-r--r--src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java (renamed from src/android/com/jogamp/android/launcher/NEWTLauncherVersionActivity.java)105
-rw-r--r--src/test/com/jogamp/opengl/test/android/NEWTGraphUIActivity.java106
12 files changed, 483 insertions, 97 deletions
diff --git a/make/build.xml b/make/build.xml
index a18406631..791e69aed 100644
--- a/make/build.xml
+++ b/make/build.xml
@@ -16,10 +16,12 @@
<target name="all.ide" description="Debug IDE build nativewindow, jogl and newt projects, including all junit tests, but don't tag the build or create archives" depends="init.debug,build.nativewindow,build.jogl,build.newt,one.dir,test.compile" />
- <target name="test.compile">
+ <target name="test.compile.1">
<ant antfile="build-test.xml" target="test.compile" inheritRefs="true" inheritAll="true"/>
</target>
+ <target name="test.compile" depends="test.compile.1,android.test.package"/>
+
<target name="test.auto.run" description="Run automated tests (junit and others) in nativewindow, jogl and newt projects">
<ant antfile="build-test.xml" target="test.auto.run" inheritRefs="true" inheritAll="true"/>
</target>
@@ -146,15 +148,16 @@
</jar>
</target>
- <target name="android.package.skip.check" depends="init,gluegen.cpptasks.detect.os">
- <uptodate property="android.package.skip" targetfile="${jar}/jogl.all-android.apk">
+ <target name="android.package.jogl.skip.check" depends="init,gluegen.cpptasks.detect.os">
+ <uptodate property="android.package.jogl.skip" targetfile="${jar}/jogl.all-android.apk">
<srcfiles dir="${jar}" includes="jogl.all-android.jar" />
<srcfiles dir="resources/android" includes="**" />
</uptodate>
</target>
- <target name="android.package" depends="init,gluegen.cpptasks.detect.os,android.package.skip.check" if="isAndroid" unless="android.package.skip">
+ <target name="android.jogl.package" depends="init,gluegen.cpptasks.detect.os,android.package.jogl.skip.check" if="isAndroid" unless="android.package.jogl.skip">
<aapt.signed
+ jarsrcdir="${src}/jogl/classes"
jarbuilddir="${jar}"
jarbasename="jogl.all-android"
nativebuilddir="${lib}"
@@ -166,9 +169,29 @@
version.name="${jogl.version.plus}" />
</target>
- <target name="android.launcher" depends="init,gluegen.cpptasks.detect.os" if="isAndroid">
+ <target name="android.package.test.skip.check" depends="init,gluegen.cpptasks.detect.os">
+ <uptodate property="android.package.test.skip" targetfile="${jar}/jogl.test.apk">
+ <srcfiles dir="${jar}" includes="jogl.test.jar" />
+ <srcfiles dir="resources/android" includes="**" />
+ </uptodate>
+ </target>
+
+ <target name="android.test.package" depends="init,gluegen.cpptasks.detect.os,android.package.test.skip.check" if="isAndroid" unless="android.package.test.skip">
+ <aapt.signed
+ jarsrcdir="${src}/test"
+ jarbuilddir="${jar}"
+ jarbasename="jogl.test"
+ nativebuilddir="${lib}"
+ nativebasename="non-existing"
+ androidmanifest.path="resources/android/AndroidManifest-test.xml"
+ androidresources.path="resources/android/res-jogl"
+ jarmanifest.path="${build.jogl}/manifest.mf"
+ version.code="${jogl_int_version}"
+ version.name="${jogl.version.plus}" />
+ </target>
+
+ <target name="android.launcher.package" depends="init,gluegen.cpptasks.detect.os" if="isAndroid">
<mkdir dir="${build}/android/classes" />
- <mkdir dir="${build}/android/jar" />
<mkdir dir="${build}/android/lib" />
<javac destdir="${build}/android/classes"
includes="com/jogamp/android/launcher/**"
@@ -180,13 +203,13 @@
<src path="${project.root}/src/android" />
<classpath location="${android.jar}"/>
</javac>
- <jar destfile="${build}/android/jar/jogllauncher.jar" filesonly="true">
+ <jar destfile="${jar}/jogl.android-launcher.jar" filesonly="true">
<fileset dir="${build}/android/classes"
includes="com/jogamp/android/launcher/**"/>
</jar>
<aapt.signed
- jarbuilddir="${build}/android/jar"
- jarbasename="jogllauncher"
+ jarbuilddir="${jar}"
+ jarbasename="jogl.android-launcher"
nativebuilddir="${build}/android/lib"
nativebasename="non-existing"
androidmanifest.path="resources/android/AndroidManifest-launcher.xml"
@@ -218,7 +241,7 @@
</condition>
</target>
- <target name="one.dir" depends="one.dir.skip.check, one.jar.dir, android.package, android.launcher"/>
+ <target name="one.dir" depends="one.dir.skip.check, one.jar.dir, android.jogl.package, android.launcher.package"/>
<target name="repack-jars" depends="one.jar.dir">
<!-- Re-pack jars we have the intent to compress later, after signing -->
diff --git a/make/resources/android/AndroidManifest-launcher.xml b/make/resources/android/AndroidManifest-launcher.xml
index 1dfec1cb7..a69e6f865 100644
--- a/make/resources/android/AndroidManifest-launcher.xml
+++ b/make/resources/android/AndroidManifest-launcher.xml
@@ -6,30 +6,43 @@
<uses-sdk android:minSdkVersion="9" />
<uses-library android:name="com.jogamp.common" android:required="true" />
<uses-library android:name="javax.media.opengl" android:required="true" />
+ <uses-library android:name="com.jogamp.opengl.test" android:required="true" />
<application android:icon="@drawable/icon"
android:label="@string/app_name"
android:description="@string/app_descr"
android:persistent="false"
>
- <activity android:name="com.jogamp.android.launcher.NEWTLauncherVersionActivity"
+ <activity android:name="com.jogamp.android.launcher.NEWTLauncherGearsES1Activity"
android:finishOnTaskLaunch="true"
android:launchMode="singleTop"
android:configChanges="keyboardHidden|orientation"
- android:label="@string/activity_v_name"
- android:description="@string/activity_v_descr"
+ android:label="@string/activity_gearses1_name"
+ android:description="@string/activity_gearses1_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.NEWTLauncherGearsActivity"
+ <activity android:name="com.jogamp.android.launcher.NEWTLauncherGearsES2Activity"
android:finishOnTaskLaunch="true"
android:launchMode="singleTop"
android:configChanges="keyboardHidden|orientation"
- android:label="@string/activity_gears1_name"
- android:description="@string/activity_gears1_descr"
+ android:label="@string/activity_gearses2_name"
+ android:description="@string/activity_gearses2_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.NEWTLauncherGraphUIActivity"
+ android:finishOnTaskLaunch="true"
+ android:launchMode="singleTop"
+ android:configChanges="keyboardHidden|orientation"
+ android:label="@string/activity_graphui_name"
+ android:description="@string/activity_graphui_descr"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
diff --git a/make/resources/android/res-launcher/values/strings.xml b/make/resources/android/res-launcher/values/strings.xml
index 23b0248bd..e9bb75b65 100644
--- a/make/resources/android/res-launcher/values/strings.xml
+++ b/make/resources/android/res-launcher/values/strings.xml
@@ -3,8 +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_v_name">Jogl\'s Version</string>
- <string name="activity_v_descr">Shows the version of the Jogl Library.</string>
- <string name="activity_gears1_name">Gears ES1</string>
- <string name="activity_gears1_descr">Gears ES1</string>
+ <string name="activity_gearses1_name">GearsES1</string>
+ <string name="activity_gearses1_descr">GearsES1</string>
+ <string name="activity_gearses2_name">GearsES2</string>
+ <string name="activity_gearses2_descr">GearsES2</string>
+ <string name="activity_graphui_name">GraphUI</string>
+ <string name="activity_graphui_descr">GraphUI</string>
</resources>
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index ee15e8562..a3e8c92f3 100755
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -57,10 +57,6 @@ function jrun() {
#D_ARGS="-Dnativewindow.debug.ToolkitLock.TraceLock -Dnativewindow.debug.X11Util.TraceDisplayLifecycle=true -Dnativewindow.debug.X11Util"
#D_ARGS="-Dnativewindow.debug.X11Util -Djogl.debug.GLContext -Djogl.debug.GLDrawable -Dnewt.debug=all"
#D_ARGS="-Dnativewindow.debug.X11Util"
- #D_ARGS="-Dnativewindow.x11.mt-bug=true"
- #D_ARGS="-Dnativewindow.x11.mt-bug=true -Djogl.debug.DebugGL"
- #D_ARGS="-Dnativewindow.x11.mt-bug=true -Djogl.debug=all"
- #D_ARGS="-Dnativewindow.x11.mt-bug=true -Dnativewindow.debug.NativeWindow -Dnativewindow.debug.X11Util -Dnativewindow.debug.ToolkitLock.TraceLock -Dnativewindow.debug.X11Util.TraceDisplayLifecycle=true"
#D_ARGS="-Djogamp.common.utils.locks.Lock.timeout=600000 -Djogamp.debug.Lock -Djogamp.debug.Lock.TraceLock"
#D_ARGS="-Djogamp.common.utils.locks.Lock.timeout=1000 -Djogamp.debug.Lock -Djogamp.debug.Lock.TraceLock"
#D_ARGS="-Dnewt.debug.EDT -Djogamp.common.utils.locks.Lock.timeout=600000 -Djogl.debug.Animator -Dnewt.debug.Display -Dnewt.debug.Screen"
@@ -73,10 +69,10 @@ function jrun() {
#D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GraphicsConfiguration"
#D_ARGS="-Dnewt.debug.EDT"
#D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all -Dnewt.debug=all"
- #D_ARGS="-Djogl.debug=all -Dnewt.debug=all"
+ D_ARGS="-Djogl.debug=all -Dnewt.debug=all"
#D_ARGS="-Dnewt.debug.Window -Dnewt.debug.Display -Dnewt.debug.EDT -Djogl.debug.GLContext"
#D_ARGS="-Dnewt.debug.Window -Djogl.debug.Animator -Dnewt.debug.Screen"
- D_ARGS="-Dnewt.debug.Window"
+ #D_ARGS="-Dnewt.debug.Window"
#D_ARGS="-Xprof"
#D_ARGS="-Djogl.debug.Animator"
#D_ARGS="-Dnativewindow.debug=all"
@@ -224,7 +220,7 @@ function testawtmt() {
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting02AWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting03AWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting03AWT $*
-testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting03bAWT $*
+#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting03bAWT $*
#testawt com.jogamp.opengl.test.junit.newt.TestCloseNewtAWT
#testawt com.jogamp.opengl.test.junit.jogl.caps.TestMultisampleAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.caps.TestMultisampleNEWT $*
@@ -250,7 +246,7 @@ testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting03bAWT $*
#testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUTextNewtDemo02 $*
#testnoawt com.jogamp.opengl.test.junit.graph.demos.GPURegionNewtDemo01 $*
#testnoawt com.jogamp.opengl.test.junit.graph.demos.GPURegionNewtDemo02 $*
-#testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtDemo01 $*
+testnoawt com.jogamp.opengl.test.junit.graph.demos.GPUUISceneNewtDemo01 $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGPUMemSec01NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMapBuffer01NEWT $*
diff --git a/src/android/com/jogamp/android/launcher/ClassLoaderUtil.java b/src/android/com/jogamp/android/launcher/ClassLoaderUtil.java
index 746fad745..df4a9e7b8 100644
--- a/src/android/com/jogamp/android/launcher/ClassLoaderUtil.java
+++ b/src/android/com/jogamp/android/launcher/ClassLoaderUtil.java
@@ -40,34 +40,31 @@ public class ClassLoaderUtil {
public static final String packageGlueGen = "com.jogamp.common";
public static final String packageJogl = "javax.media.opengl";
+ public static final String packageJoglTest = "com.jogamp.opengl.test";
public static final String dexPathName= "jogampDex";
public static final String libPathName = "/data/data/com.jogamp.common/lib/:/data/data/javax.media.opengl/lib/";
- public static synchronized ClassLoader createJogampClassLoaderSingleton(Context ctx, boolean debugOn) {
+ public static synchronized ClassLoader createJogampClassLoaderSingleton(Context ctx) {
Log.d(TAG, "S");
- if(debugOn) {
- System.setProperty("jogl.debug", "all");
- System.setProperty("jogamp.debug.JNILibLoader", "true");
- System.setProperty("jogamp.debug.NativeLibrary", "true");
- }
-
String apkGlueGen = null;
String apkJogl = null;
+ String apkJoglTest = null;
try {
apkGlueGen = ctx.getPackageManager().getApplicationInfo(packageGlueGen,0).sourceDir;
apkJogl = ctx.getPackageManager().getApplicationInfo(packageJogl,0).sourceDir;
+ apkJoglTest = ctx.getPackageManager().getApplicationInfo(packageJoglTest,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+">");
+ if(null == apkGlueGen || null == apkJogl || null == apkJoglTest) {
+ Log.d(TAG, "not found: gluegen <"+apkGlueGen+">, jogl <"+apkJogl+">, jogl-test <"+apkJoglTest+">");
return null;
}
- final String cp = apkGlueGen + ":" + apkJogl ;
+ final String cp = apkGlueGen + ":" + apkJogl + ":" + apkJoglTest ;
Log.d(TAG, "cp: " + cp);
final File dexPath = ctx.getDir(dexPathName, Context.MODE_WORLD_READABLE);
diff --git a/src/android/com/jogamp/android/launcher/NEWTLauncherActivity.java b/src/android/com/jogamp/android/launcher/NEWTLauncherActivity.java
new file mode 100644
index 000000000..86e98a38c
--- /dev/null
+++ b/src/android/com/jogamp/android/launcher/NEWTLauncherActivity.java
@@ -0,0 +1,229 @@
+/**
+ * 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.android.launcher;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.widget.TextView;
+import android.util.Log;
+
+public abstract class NEWTLauncherActivity extends Activity {
+ static final String TAG = "NEWTLauncherActivity";
+ TextView tv = null;
+ Method mOnCreate, mOnDestroy, mOnPause, mOnRestart, mOnResume,
+ mOnStart, mOnStop, mSetIsInvokedByExternalActivity;
+ Class<?> activityClazz = null;
+ Object activityObject = null;
+
+ public abstract String getDownstreamActivityName();
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ Log.d(TAG, "onCreate - S");
+ super.onCreate(savedInstanceState);
+
+ // System.setProperty("nativewindow.debug", "all");
+ // System.setProperty("jogl.debug", "all");
+ // System.setProperty("newt.debug", "all");
+ System.setProperty("newt.debug.Window", "true");
+ // System.setProperty("newt.debug.Window.MouseEvent", "true");
+ // System.setProperty("newt.debug.Window.KeyEvent", "true");
+ // System.setProperty("jogamp.debug.IOUtil", "true");
+ // System.setProperty("jogamp.debug.JNILibLoader", "true");
+ // System.setProperty("jogamp.debug.NativeLibrary", "true");
+ // System.setProperty("jogamp.debug.NativeLibrary.Lookup", "true");
+
+ ClassLoader cl = ClassLoaderUtil.createJogampClassLoaderSingleton(this);
+ if(null != cl) {
+ try {
+ activityClazz = Class.forName(getDownstreamActivityName(), true, cl);
+ Log.d(TAG, "Activity Clazz "+activityClazz);
+ activityObject = createInstance(activityClazz, null);
+ Log.d(TAG, "Activity Object "+activityObject);
+ mOnCreate = activityClazz.getMethod("onCreate", Bundle.class);
+ mOnDestroy = activityClazz.getMethod("onDestroy");
+ mOnPause = activityClazz.getMethod("onPause");
+ mOnRestart = activityClazz.getMethod("onRestart");
+ mOnResume = activityClazz.getMethod("onResume");
+ mOnStart = activityClazz.getMethod("onStart");
+ mOnStop = activityClazz.getMethod("onStop");
+ mSetIsInvokedByExternalActivity = activityClazz.getMethod("setIsInvokedByExternalActivity", Activity.class);
+ } catch (Exception e) {
+ Log.d(TAG, "error: "+e, e);
+ throw new RuntimeException(e);
+ }
+ }
+
+ if( null == mOnCreate || null == mOnDestroy || null == mOnPause ||
+ null == mOnRestart || null == mOnResume ||
+ null == mSetIsInvokedByExternalActivity ) {
+ RuntimeException e = new RuntimeException("XXX - incomplete method set");
+ Log.d(TAG, "error: "+e, e);
+ throw e;
+ }
+ callMethod(activityObject, mSetIsInvokedByExternalActivity, this);
+
+ callMethod(activityObject, mOnCreate, savedInstanceState);
+ Log.d(TAG, "onCreate - X");
+ }
+
+ @Override
+ public void onStart() {
+ Log.d(TAG, "onStart - S");
+ callMethod(activityObject, mOnStart);
+ super.onStart();
+ Log.d(TAG, "onStart - X");
+ }
+
+ @Override
+ public void onRestart() {
+ Log.d(TAG, "onRestart - S");
+ callMethod(activityObject, mOnRestart);
+ super.onRestart();
+ Log.d(TAG, "onRestart - X");
+ }
+
+ @Override
+ public void onResume() {
+ Log.d(TAG, "onResume - S");
+ callMethod(activityObject, mOnResume);
+ super.onResume();
+ Log.d(TAG, "onResume - X");
+ }
+
+ @Override
+ public void onPause() {
+ Log.d(TAG, "onPause - S");
+ callMethod(activityObject, mOnPause);
+ super.onPause();
+ Log.d(TAG, "onPause - X");
+ }
+
+ @Override
+ public void onStop() {
+ Log.d(TAG, "onStop - S");
+ callMethod(activityObject, mOnStop);
+ super.onStop();
+ Log.d(TAG, "onStop - X");
+ }
+
+ @Override
+ public void onDestroy() {
+ Log.d(TAG, "onDestroy - S");
+ callMethod(activityObject, mOnDestroy);
+ super.onDestroy();
+ Log.d(TAG, "onDestroy - X");
+ }
+
+ /**
+ * @throws JogampRuntimeException if the instance can not be created.
+ */
+ public static final Object createInstance(Class<?> clazz, Class<?>[] cstrArgTypes, Object ... cstrArgs)
+ throws RuntimeException
+ {
+ return createInstance(getConstructor(clazz, cstrArgTypes), cstrArgs);
+ }
+
+ public static final Object createInstance(Constructor<?> cstr, Object ... cstrArgs)
+ throws RuntimeException
+ {
+ try {
+ return cstr.newInstance(cstrArgs);
+ } catch (Exception e) {
+ Throwable t = e;
+ if (t instanceof InvocationTargetException) {
+ t = ((InvocationTargetException) t).getTargetException();
+ }
+ if (t instanceof Error) {
+ throw (Error) t;
+ }
+ if (t instanceof RuntimeException) {
+ throw (RuntimeException) t;
+ }
+ throw new RuntimeException("can not create instance of "+cstr.getName(), t);
+ }
+ }
+
+ /**
+ * @throws JogampRuntimeException if the constructor can not be delivered.
+ */
+ protected static final Constructor<?> getConstructor(Class<?> clazz, Class<?> ... cstrArgTypes)
+ throws RuntimeException {
+ try {
+ if(null == cstrArgTypes) {
+ cstrArgTypes = zeroTypes;
+ }
+ return clazz.getDeclaredConstructor(cstrArgTypes);
+ } catch (NoSuchMethodException ex) {
+ throw new RuntimeException("Constructor: '" + clazz + "(" + asString(cstrArgTypes) + ")' not found", ex);
+ }
+ }
+
+ protected static final Class<?>[] zeroTypes = new Class[0];
+
+ protected static final String asString(Class<?>[] argTypes) {
+ StringBuffer args = new StringBuffer();
+ boolean coma = false;
+ if(null != argTypes) {
+ for (int i = 0; i < argTypes.length; i++) {
+ if(coma) {
+ args.append(", ");
+ }
+ args.append(argTypes[i].getName());
+ coma = true;
+ }
+ }
+ return args.toString();
+ }
+
+ protected static final Object callMethod(Object instance, Method method, Object ... args)
+ throws RuntimeException
+ {
+ try {
+ return method.invoke(instance, args);
+ } catch (Exception e) {
+ Throwable t = e;
+ if (t instanceof InvocationTargetException) {
+ t = ((InvocationTargetException) t).getTargetException();
+ }
+ if (t instanceof Error) {
+ throw (Error) t;
+ }
+ if (t instanceof RuntimeException) {
+ throw (RuntimeException) t;
+ }
+ throw new RuntimeException("calling "+method+" failed", t);
+ }
+ }
+
+
+}
diff --git a/src/android/com/jogamp/android/launcher/NEWTLauncherGearsES1Activity.java b/src/android/com/jogamp/android/launcher/NEWTLauncherGearsES1Activity.java
new file mode 100644
index 000000000..bc179eb9f
--- /dev/null
+++ b/src/android/com/jogamp/android/launcher/NEWTLauncherGearsES1Activity.java
@@ -0,0 +1,11 @@
+package com.jogamp.android.launcher;
+
+public class NEWTLauncherGearsES1Activity extends NEWTLauncherActivity {
+ static String demo = "com.jogamp.opengl.test.android.NEWTGearsES1Activity";
+
+ @Override
+ public String getDownstreamActivityName() {
+ return demo;
+ }
+
+}
diff --git a/src/android/com/jogamp/android/launcher/NEWTLauncherGearsES2Activity.java b/src/android/com/jogamp/android/launcher/NEWTLauncherGearsES2Activity.java
new file mode 100644
index 000000000..170d1b5a7
--- /dev/null
+++ b/src/android/com/jogamp/android/launcher/NEWTLauncherGearsES2Activity.java
@@ -0,0 +1,11 @@
+package com.jogamp.android.launcher;
+
+public class NEWTLauncherGearsES2Activity extends NEWTLauncherActivity {
+ static String demo = "com.jogamp.opengl.test.android.NEWTGearsES2Activity";
+
+ @Override
+ public String getDownstreamActivityName() {
+ return demo;
+ }
+
+}
diff --git a/src/android/com/jogamp/android/launcher/NEWTLauncherGraphUIActivity.java b/src/android/com/jogamp/android/launcher/NEWTLauncherGraphUIActivity.java
new file mode 100644
index 000000000..e1bab1e70
--- /dev/null
+++ b/src/android/com/jogamp/android/launcher/NEWTLauncherGraphUIActivity.java
@@ -0,0 +1,11 @@
+package com.jogamp.android.launcher;
+
+public class NEWTLauncherGraphUIActivity extends NEWTLauncherActivity {
+ static String demo = "com.jogamp.opengl.test.android.NEWTGraphUIActivity";
+
+ @Override
+ public String getDownstreamActivityName() {
+ return demo;
+ }
+
+}
diff --git a/src/android/com/jogamp/android/launcher/NEWTLauncherGearsActivity.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java
index 785590fd7..785590fd7 100644
--- a/src/android/com/jogamp/android/launcher/NEWTLauncherGearsActivity.java
+++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES1Activity.java
diff --git a/src/android/com/jogamp/android/launcher/NEWTLauncherVersionActivity.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java
index c07b502fb..12ef40280 100644
--- a/src/android/com/jogamp/android/launcher/NEWTLauncherVersionActivity.java
+++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java
@@ -25,92 +25,79 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-package com.jogamp.android.launcher;
+package com.jogamp.opengl.test.android;
-import java.lang.reflect.Method;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLProfile;
-import dalvik.system.DexClassLoader;
-import dalvik.system.PathClassLoader;
+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.app.Activity;
-import android.content.pm.PackageManager;
import android.os.Bundle;
-import android.widget.TextView;
import android.util.Log;
+import android.widget.TextView;
-public class NEWTLauncherVersionActivity extends Activity {
- static final String TAG = "JoglLauncherActivity";
+public class NEWTGearsES2Activity extends NewtBaseActivity {
+ GLWindow glWindow = null;
+ Animator animator = null;
TextView tv = null;
+ static String TAG = "NEWTGearsES2Activity";
@Override
public void onCreate(Bundle savedInstanceState) {
- Log.d(TAG, "onCreate - S");
+ Log.d(TAG, "onCreate - 0");
super.onCreate(savedInstanceState);
- String clazzMDName= "jogamp.newt.driver.android.MD";
- String mdInfo = null;
+ // 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);
+ setContentView(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 = new Animator(glWindow);
+ animator.setUpdateFPSFrames(60, System.err);
- ClassLoader cl = ClassLoaderUtil.createJogampClassLoaderSingleton(this, true);
- if(null != cl) {
- try {
- Class clazzMD= Class.forName(clazzMDName, true, cl);
- Log.d(TAG, "MD: "+clazzMD);
- Method mdGetInfo = clazzMD.getMethod("getInfo");
- mdInfo = (String) mdGetInfo.invoke(null);
- } catch (Exception e) {
- Log.d(TAG, "error: "+e, e);
- }
- }
-
- tv = new TextView(this);
- if(null != mdInfo) {
- tv.setText(mdInfo);
- } else {
- tv.setText("mdInfo n/a");
- }
- setContentView(tv);
Log.d(TAG, "onCreate - X");
}
@Override
- public void onStart() {
- Log.d(TAG, "onStart - S");
- super.onStart();
- Log.d(TAG, "onStart - X");
- }
-
- @Override
- public void onRestart() {
- Log.d(TAG, "onRestart - S");
- super.onRestart();
- Log.d(TAG, "onRestart - X");
- }
-
- @Override
public void onResume() {
- Log.d(TAG, "onResume - S");
super.onResume();
- Log.d(TAG, "onResume - X");
+ if(null != animator) {
+ animator.start();
+ }
}
@Override
public void onPause() {
- Log.d(TAG, "onPause - S");
super.onPause();
- Log.d(TAG, "onPause - X");
- }
-
- @Override
- public void onStop() {
- Log.d(TAG, "onStop - S");
- super.onStop();
- Log.d(TAG, "onStop - X");
+ if(null != animator) {
+ animator.pause();
+ }
}
@Override
public void onDestroy() {
- Log.d(TAG, "onDestroy - S");
- super.onDestroy();
- Log.d(TAG, "onDestroy - X");
+ 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
new file mode 100644
index 000000000..d6ab28f13
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/android/NEWTGraphUIActivity.java
@@ -0,0 +1,106 @@
+/**
+ * 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.graph.demos.GPUUISceneGLListener0A;
+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
+ 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.setAlphaBits(4);
+ caps.setNumSamples(4);
+ caps.setSampleBuffers(true);
+ Log.d(TAG, "req caps: "+caps);
+ glWindow = GLWindow.create(caps);
+ setContentView(glWindow);
+
+ glWindow.addGLEventListener(new GPUUISceneGLListener0A());
+ 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(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();
+ }
+ }
+}