aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt/classes')
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/MD.java29
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/NEWTSurfaceView.java62
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java9
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/SurfaceCallback.java54
4 files changed, 85 insertions, 69 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/android/MD.java b/src/newt/classes/jogamp/newt/driver/android/MD.java
index 9a2ed9824..06f787233 100644
--- a/src/newt/classes/jogamp/newt/driver/android/MD.java
+++ b/src/newt/classes/jogamp/newt/driver/android/MD.java
@@ -27,6 +27,11 @@
*/
package jogamp.newt.driver.android;
+import java.util.List;
+
+import javax.media.opengl.GLDrawableFactory;
+import javax.media.opengl.GLProfile;
+
import com.jogamp.common.GlueGenVersion;
import com.jogamp.common.os.Platform;
import com.jogamp.common.util.VersionUtil;
@@ -36,9 +41,25 @@ public class MD {
public static final String TAG = "JogAmp.NEWT";
public static String getInfo() {
- return VersionUtil.getPlatformInfo()+Platform.NEWLINE+
- GlueGenVersion.getInstance()+Platform.NEWLINE+
- JoglVersion.getInstance()+Platform.NEWLINE+
- Platform.NEWLINE;
+
+ StringBuffer sb = new StringBuffer();
+
+ sb.append(VersionUtil.getPlatformInfo()).append(Platform.NEWLINE)
+ .append(GlueGenVersion.getInstance()).append(Platform.NEWLINE)
+ .append(JoglVersion.getInstance()).append(Platform.NEWLINE)
+ .append(Platform.NEWLINE);
+
+ final GLDrawableFactory factory = GLDrawableFactory.getEGLFactory();
+ final List/*<GLCapabilitiesImmutable>*/ availCaps = factory.getAvailableCapabilities(null);
+ for(int i=0; i<availCaps.size(); i++) {
+ sb.append(availCaps.get(i)).append(Platform.NEWLINE);
+ }
+
+ return sb.toString();
}
+
+ public static void main(String args[]) {
+
+ System.err.println(getInfo());
+ }
}
diff --git a/src/newt/classes/jogamp/newt/driver/android/NEWTSurfaceView.java b/src/newt/classes/jogamp/newt/driver/android/NEWTSurfaceView.java
index 0a2cfcf05..8d163f874 100644
--- a/src/newt/classes/jogamp/newt/driver/android/NEWTSurfaceView.java
+++ b/src/newt/classes/jogamp/newt/driver/android/NEWTSurfaceView.java
@@ -27,19 +27,69 @@
*/
package jogamp.newt.driver.android;
+import javax.media.opengl.GLProfile;
+import javax.microedition.khronos.egl.EGL10;
+import javax.microedition.khronos.egl.EGLContext;
+import javax.microedition.khronos.egl.EGLDisplay;
+
import android.content.Context;
+import android.util.Log;
+import android.view.Surface;
+import android.view.SurfaceHolder;
import android.view.SurfaceView;
+import android.view.SurfaceHolder.Callback2;
-public class NEWTSurfaceView extends SurfaceView {
+public class NEWTSurfaceView extends SurfaceView implements Callback2 {
- SurfaceCallback scb;
-
public NEWTSurfaceView(Context context) {
super(context);
- scb = new SurfaceCallback();
- this.getHolder().addCallback(scb);
+
+ System.setProperty("jogl.debug", "all");
+ System.setProperty("jogamp.debug.JNILibLoader", "true");
+ System.setProperty("jogamp.debug.NativeLibrary", "true");
+ System.setProperty("jogamp.debug.NativeLibrary.Lookup", "true");
+ getHolder().addCallback(this);
}
- public void doSomething() {
+ boolean created = false;
+
+ public final boolean isCreated() {
+ return created;
+ }
+
+ public void surfaceCreated(SurfaceHolder holder) {
+ Surface surface = getHolder().getSurface();
+
+ /**
+ EGL10 mEgl = (EGL10) EGLContext.getEGL();
+
+ EGLDisplay mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
+
+ if (mEglDisplay == EGL10.EGL_NO_DISPLAY) {
+ throw new RuntimeException("eglGetDisplay failed");
+ }
+ Log.d(MD.TAG, "EGL XXXXXX " + mEgl + ", " + mEglDisplay);
+ */
+ Log.d(MD.TAG, "YYYYYYYYYY ");
+ Log.d(MD.TAG, "surfaceCreated - 0 - isValid: "+surface.isValid());
+ GLProfile.initSingleton(true);
+ Log.d(MD.TAG, "surfaceCreated - 1");
+ Log.d(MD.TAG, MD.getInfo());
+ Log.d(MD.TAG, "surfaceCreated - X");
+ created = true;
+ }
+
+ public void surfaceChanged(SurfaceHolder holder, int format, int width,
+ int height) {
+ Log.d(MD.TAG, "surfaceChanged: f "+Integer.toString(format)+", "+width+"x"+height);
+ }
+
+ public void surfaceDestroyed(SurfaceHolder holder) {
+ Log.d(MD.TAG, "surfaceDestroyed");
+ created = false;
+ }
+
+ public void surfaceRedrawNeeded(SurfaceHolder holder) {
+ Log.d(MD.TAG, "surfaceRedrawNeeded");
}
}
diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java
index b9452e44b..011c0c223 100644
--- a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java
+++ b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java
@@ -33,15 +33,14 @@ import android.widget.TextView;
import android.util.Log;
public class NewtVersionActivity extends Activity {
- TextView tv = null;
-
+ NEWTSurfaceView nsv = null;
+
@Override
public void onCreate(Bundle savedInstanceState) {
Log.d(MD.TAG, "onCreate - S");
super.onCreate(savedInstanceState);
- tv = new TextView(this);
- tv.setText("need launcher");
- setContentView(tv);
+ nsv = new NEWTSurfaceView(this);
+ setContentView(nsv);
Log.d(MD.TAG, "onCreate - X");
}
diff --git a/src/newt/classes/jogamp/newt/driver/android/SurfaceCallback.java b/src/newt/classes/jogamp/newt/driver/android/SurfaceCallback.java
deleted file mode 100644
index f953fe41d..000000000
--- a/src/newt/classes/jogamp/newt/driver/android/SurfaceCallback.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * 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 jogamp.newt.driver.android;
-
-import jogamp.common.os.android.MD;
-import android.view.SurfaceHolder;
-import android.view.SurfaceHolder.Callback2;
-import android.util.Log;
-
-public class SurfaceCallback implements Callback2 {
-
- public void surfaceCreated(SurfaceHolder holder) {
- Log.d(MD.TAG, "surfaceCreated");
- }
-
- public void surfaceChanged(SurfaceHolder holder, int format, int width,
- int height) {
- Log.d(MD.TAG, "surfaceChanged: f "+Integer.toString(format)+", "+width+"x"+height);
- }
-
- public void surfaceDestroyed(SurfaceHolder holder) {
- Log.d(MD.TAG, "surfaceDestroyed");
- }
-
- public void surfaceRedrawNeeded(SurfaceHolder holder) {
- Log.d(MD.TAG, "surfaceRedrawNeeded");
- }
-
-}