summaryrefslogtreecommitdiffstats
path: root/src/newt
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-05-04 05:31:27 +0200
committerSven Gothel <[email protected]>2012-05-04 05:31:27 +0200
commita38f799a0d771e0396df04261c2ab7642480f865 (patch)
tree4964eb11f3cf3933262b076819260f70b2157b6f /src/newt
parent137e58ba482e20822ff313716e0d2d9d56587dd9 (diff)
Android: Fix JOGL's (NEWT) Version activity: Use Launcher, show GL version
Diffstat (limited to 'src/newt')
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java65
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/NewtVersionActivityLauncher.java21
2 files changed, 76 insertions, 10 deletions
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
+ }
+}