diff options
4 files changed, 79 insertions, 13 deletions
diff --git a/make/resources/android/AndroidManifest-jogl.xml b/make/resources/android/AndroidManifest-jogl.xml index c2017d37c..f69b5dea6 100644 --- a/make/resources/android/AndroidManifest-jogl.xml +++ b/make/resources/android/AndroidManifest-jogl.xml @@ -11,7 +11,7 @@ android:description="@string/app_descr" android:persistent="false" > - <activity android:name="jogamp.newt.driver.android.NewtVersionActivity" + <activity android:name="jogamp.newt.driver.android.NewtVersionActivityLauncher" android:finishOnTaskLaunch="true" android:launchMode="singleTop" android:configChanges="keyboardHidden|orientation" diff --git a/make/resources/android/res-jogl/values/strings.xml b/make/resources/android/res-jogl/values/strings.xml index 6c0a469e0..3064dad88 100644 --- a/make/resources/android/res-jogl/values/strings.xml +++ b/make/resources/android/res-jogl/values/strings.xml @@ -3,6 +3,6 @@ <string name="hello">Jogl Library</string> <string name="app_name">JogAmp\'s Jogl Library</string> <string name="app_descr">Contains Dalvik and native code, supporting native bindings.</string> - <string name="activity_v_name">Jogl</string> - <string name="activity_v_descr">The Jogl Library.</string> + <string name="activity_v_name">Jogl\'s Version</string> + <string name="activity_v_descr">Shows the version of the JOGL Library and runtime GL infos.</string> </resources> diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java index d37901793..36b83337a 100644 --- a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java +++ b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java @@ -27,33 +27,78 @@ */ package jogamp.newt.driver.android; +import javax.media.opengl.GL; +import javax.media.opengl.GLAutoDrawable; +import javax.media.opengl.GLCapabilities; +import javax.media.opengl.GLEventListener; +import javax.media.opengl.GLProfile; + 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 android.os.Bundle; import android.util.Log; +import android.view.Gravity; +import android.view.ViewGroup.LayoutParams; +import android.widget.ScrollView; import android.widget.TextView; public class NewtVersionActivity extends NewtBaseActivity { - TextView tv = null; - @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - System.setProperty("nativewindow.debug", "all"); - System.setProperty("jogl.debug", "all"); - System.setProperty("newt.debug", "all"); - System.setProperty("jogamp.debug.JNILibLoader", "true"); - System.setProperty("jogamp.debug.NativeLibrary", "true"); - // System.setProperty("jogamp.debug.NativeLibrary.Lookup", "true"); + setFullscreenFeature(getWindow(), true); + + final android.view.ViewGroup viewGroup = new android.widget.FrameLayout(getActivity().getApplicationContext()); + getWindow().setContentView(viewGroup); + + final TextView tv = new TextView(getActivity()); + final ScrollView scroller = new ScrollView(getActivity()); + scroller.addView(tv); + viewGroup.addView(scroller, new android.widget.FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, Gravity.TOP|Gravity.LEFT)); - 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.GLES2)); + GLWindow glWindow = GLWindow.create(caps); + glWindow.setUndecorated(true); + glWindow.setSize(32, 32); + glWindow.setPosition(0, 0); + final android.view.View androidGLView = ((AndroidWindow)glWindow.getDelegatedWindow()).getAndroidView(); + viewGroup.addView(androidGLView, new android.widget.FrameLayout.LayoutParams(glWindow.getWidth(), glWindow.getHeight(), Gravity.BOTTOM|Gravity.RIGHT)); + registerNEWTWindow(glWindow); + + glWindow.addGLEventListener(new GLEventListener() { + public void init(GLAutoDrawable drawable) { + GL gl = drawable.getGL(); + final StringBuffer sb = new StringBuffer(); + sb.append(JoglVersion.getGLInfo(gl, null)).append(Platform.NEWLINE); + sb.append("Requested: ").append(Platform.NEWLINE); + sb.append(drawable.getNativeSurface().getGraphicsConfiguration().getRequestedCapabilities()).append(Platform.NEWLINE).append(Platform.NEWLINE); + sb.append("Chosen: ").append(Platform.NEWLINE); + sb.append(drawable.getChosenGLCapabilities()).append(Platform.NEWLINE).append(Platform.NEWLINE); + viewGroup.post(new Runnable() { + public void run() { + tv.append(sb.toString()); + viewGroup.removeView(androidGLView); + } } ); + } + + public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + } + + public void display(GLAutoDrawable drawable) { + } + public void dispose(GLAutoDrawable drawable) { + } + }); + glWindow.setVisible(true); Log.d(MD.TAG, "onCreate - X"); } } diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivityLauncher.java b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivityLauncher.java new file mode 100644 index 000000000..cb8799b19 --- /dev/null +++ b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivityLauncher.java @@ -0,0 +1,21 @@ +package jogamp.newt.driver.android; + +import android.app.Activity; +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; +import android.util.Log; + +public class NewtVersionActivityLauncher extends Activity { + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + final Uri uri = Uri.parse("launch://jogamp.org/jogamp.newt.driver.android.NewtVersionActivity"); + final Intent intent = new Intent("org.jogamp.launcher.action.LAUNCH_ACTIVITY_NORMAL", uri); + Log.d(getClass().getSimpleName(), "Launching Activity: "+intent); + startActivity (intent); + + finish(); // done + } +} |