summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-01-20 15:05:02 +0100
committerSven Gothel <[email protected]>2013-01-20 15:05:02 +0100
commit85d70b7d38885fa8ba6374aa790d5a296acc8ec1 (patch)
tree7aaf7d638fad47252695cc55894a6f3404d14b45
parent0989484b89535d56e9f150cdf63e2a17bf36e32e (diff)
Android: Allow selection of native window formats RGBA8888, RGBX8888 and RGB565; Fix HiSilicon/Vivante/Immersion.16 EGLConfig selection (zero depth buffer @ visualID)
- NEWT/Android Fix PixelFormat/NativeWindowFormat/VisualID Selection - Fix allows proper selection of native window formats: RGBA8888, RGBX8888 and RGB565 - Selection is performed in 3 steps: 1) @ Construction (non native): SurfaceHolder.setFormat( getSurfaceHolderFormat( caps ) ) 2) @ Native Surface Creation: getANativeWindowFormat( androidFormat) -> ANativeWindow_setBuffersGeometry(..) Note: The set native format is revalidated, i.e. read out via ANativeWindow_getFormat(..). 3) @ EGL Creation: ANativeWindow_getFormat(..) -> fixCaps(..) - simply fixing the chosen caps. - NEWT GLWindow.GLLifecycleHook.resetCounter: - Also reset GLAnimatorControl's counter, if attached. - NEWT WindowImpl -> GLLifecycleHook.resetCounter() calls issued _after_ operation before unlock(). - JOGL/EGLGraphicsConfigurationFactory - Validate whether the visualID matching EGLConfig depth buffer is suitable. On HiSilicon/Vivante/Immersion.16: Depth buffer w/ matching visualID is zero! - NativeWindow/Capabilities.compareTo: Fix alpha comparison
-rw-r--r--make/resources/android/AndroidManifest-test.xml20
-rw-r--r--make/resources/android/res-test/values/strings.xml4
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java11
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java12
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/Capabilities.java8
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/GLWindow.java4
-rw-r--r--src/newt/classes/jogamp/newt/WindowImpl.java14
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/WindowDriver.java128
-rw-r--r--src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java15
-rw-r--r--src/test/com/jogamp/opengl/test/android/NEWTGearsES2ECTActivityLauncher.java75
-rw-r--r--src/test/com/jogamp/opengl/test/android/NEWTGearsES2RGB565ActivityLauncher.java75
11 files changed, 308 insertions, 58 deletions
diff --git a/make/resources/android/AndroidManifest-test.xml b/make/resources/android/AndroidManifest-test.xml
index 0817b3450..5357d0a18 100644
--- a/make/resources/android/AndroidManifest-test.xml
+++ b/make/resources/android/AndroidManifest-test.xml
@@ -28,6 +28,26 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
+ <activity android:name="com.jogamp.opengl.test.android.NEWTGearsES2RGB565ActivityLauncher"
+ android:label="@string/activity_gearses2rgb565_name"
+ android:description="@string/activity_gearses2rgb565_descr"
+ android:theme="@android:style/Theme.NoDisplay"
+ >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity android:name="com.jogamp.opengl.test.android.NEWTGearsES2ECTActivityLauncher"
+ android:label="@string/activity_gearses2ect_name"
+ android:description="@string/activity_gearses2ect_descr"
+ android:theme="@android:style/Theme.NoDisplay"
+ >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
<activity android:name="com.jogamp.opengl.test.android.NEWTGearsES1ActivityLauncher"
android:label="@string/activity_gearses1_name"
android:description="@string/activity_gearses1_descr"
diff --git a/make/resources/android/res-test/values/strings.xml b/make/resources/android/res-test/values/strings.xml
index fcaf102ac..0b7bd2d51 100644
--- a/make/resources/android/res-test/values/strings.xml
+++ b/make/resources/android/res-test/values/strings.xml
@@ -11,6 +11,10 @@
<string name="activity_gearses1_descr">GearsES1</string>
<string name="activity_gearses2_name">GearsES2</string>
<string name="activity_gearses2_descr">GearsES2</string>
+ <string name="activity_gearses2rgb565_name">Gears565</string>
+ <string name="activity_gearses2rgb565_descr">Gears565</string>
+ <string name="activity_gearses2ect_name">GearsECT</string>
+ <string name="activity_gearses2ect_descr">GearsECT</string>
<string name="activity_gearses2t_name">GearsES2T</string>
<string name="activity_gearses2t_descr">GearsES2T</string>
<string name="activity_graphui1p_name">GraphUI1p</string>
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java
index 71dfe1d0f..b1ffe608e 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java
@@ -72,7 +72,14 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
this.chooser = chooser;
}
- public static EGLGraphicsConfiguration create(GLCapabilitiesImmutable capsRequested, AbstractGraphicsScreen absScreen, int cfgID) {
+ /**
+ * @param capsRequested
+ * @param absScreen
+ * @param eglConfigID {@link EGL#EGL_CONFIG_ID} for which the config is being created for.
+ * @return
+ * @throws GLException if invalid EGL display.
+ */
+ public static EGLGraphicsConfiguration create(GLCapabilitiesImmutable capsRequested, AbstractGraphicsScreen absScreen, int eglConfigID) {
final AbstractGraphicsDevice absDevice = absScreen.getDevice();
if(null==absDevice || !(absDevice instanceof EGLGraphicsDevice)) {
throw new GLException("GraphicsDevice must be a valid EGLGraphicsDevice");
@@ -81,7 +88,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple
if (dpy == EGL.EGL_NO_DISPLAY) {
throw new GLException("Invalid EGL display: "+absDevice);
}
- final long cfg = EGLConfigId2EGLConfig(dpy, cfgID);
+ final long cfg = EGLConfigId2EGLConfig(dpy, eglConfigID);
if(0 < cfg) {
final int winattrmask = GLGraphicsConfigurationUtil.getExclusiveWinAttributeBits(capsRequested);
final EGLGLCapabilities caps = EGLConfig2Capabilities((EGLGraphicsDevice)absDevice, capsRequested.getGLProfile(), cfg, winattrmask, false);
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java
index f638ef82b..7e1f8a5a2 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java
@@ -411,8 +411,13 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
if( VisualIDHolder.VID_UNDEFINED != nativeVisualID ) {
List<GLCapabilitiesImmutable> removedCaps = new ArrayList<GLCapabilitiesImmutable>();
for(int i=0; i<availableCaps.size(); ) {
- VisualIDHolder vidh = (VisualIDHolder) availableCaps.get(i);
- if(vidh.getVisualID(VIDType.NATIVE) != nativeVisualID) {
+ final GLCapabilitiesImmutable aCap = availableCaps.get(i);
+ if(aCap.getVisualID(VIDType.NATIVE) != nativeVisualID) {
+ if(DEBUG) { System.err.println("Remove["+i+"] (mismatch VisualID): "+aCap); }
+ removedCaps.add(availableCaps.remove(i));
+ } if( 0 == aCap.getDepthBits() && 0 < capsChosen.getDepthBits() ) {
+ // Hack for HiSilicon/Vivante/Immersion.16 Renderer ..
+ if(DEBUG) { System.err.println("Remove["+i+"] (mismatch depth-bits): "+aCap); }
removedCaps.add(availableCaps.remove(i));
} else {
i++;
@@ -425,6 +430,9 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact
}
} else if(DEBUG) {
System.err.println("EGLGraphicsConfiguration.eglChooseConfig: post filter nativeVisualID "+toHexString(nativeVisualID)+" got configs: "+availableCaps.size());
+ for(int i=0; i<availableCaps.size(); i++) {
+ System.err.println(i+": "+availableCaps.get(i));
+ }
}
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java b/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java
index 5795e8cfe..d35f92fea 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/Capabilities.java
@@ -157,11 +157,9 @@ public class Capabilities implements CapabilitiesImmutable, Cloneable {
}
final CapabilitiesImmutable caps = (CapabilitiesImmutable) o; */
- final int a = ( alphaBits > 0 ) ? alphaBits : 1;
- final int rgba = redBits * greenBits * blueBits * a;
-
- final int xa = ( caps.getAlphaBits() ) > 0 ? caps.getAlphaBits() : 1;
- final int xrgba = caps.getRedBits() * caps.getGreenBits() * caps.getBlueBits() * xa;
+ final int rgba = redBits * greenBits * blueBits * ( alphaBits + 1 );
+
+ final int xrgba = caps.getRedBits() * caps.getGreenBits() * caps.getBlueBits() * ( caps.getAlphaBits() + 1 );
if(rgba > xrgba) {
return 1;
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index 73a4134bd..96d0f6e3b 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -443,6 +443,10 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
System.err.println("GLWindow.resetCounter() "+WindowImpl.getThreadName());
}
GLWindow.this.resetFPSCounter();
+ final GLAnimatorControl animator = GLWindow.this.getAnimator();
+ if( null != animator ) {
+ animator.resetFPSCounter();
+ }
}
@Override
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index 89c3bada6..88fbfc951 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -707,10 +707,6 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
final RecursiveLock _lock = windowLock;
_lock.lock();
try {
- if(null!=lifecycleHook) {
- lifecycleHook.resetCounter();
- }
-
if(!visible && null!=childWindows && childWindows.size()>0) {
synchronized(childWindowsLock) {
for(int i = 0; i < childWindows.size(); i++ ) {
@@ -756,6 +752,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
System.err.println("Window setVisible: END ("+getThreadName()+") "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible: "+WindowImpl.this.visible+", nativeWindowCreated: "+nativeWindowCreated+", madeVisible: "+madeVisible);
}
} finally {
+ if(null!=lifecycleHook) {
+ lifecycleHook.resetCounter();
+ }
_lock.unlock();
}
if( nativeWindowCreated || madeVisible ) {
@@ -1014,10 +1013,6 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
System.err.println("Window.reparent: START ("+getThreadName()+") valid "+isNativeValid()+", windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)+", visible "+wasVisible+", old parentWindow: "+Display.hashCodeNullSafe(parentWindow)+", new parentWindow: "+Display.hashCodeNullSafe(newParentWindow)+", forceDestroyCreate "+forceDestroyCreate+", "+x+"/"+y+" "+width+"x"+height);
}
- if(null!=lifecycleHook) {
- lifecycleHook.resetCounter();
- }
-
if(null!=newParentWindow) {
// reset position to 0/0 within parent space
x = 0;
@@ -1211,6 +1206,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
System.err.println("Window.reparentWindow: END-1 ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+ Display.hashCodeNullSafe(parentWindow)+" "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight());
}
} finally {
+ if(null!=lifecycleHook) {
+ lifecycleHook.resetCounter();
+ }
_lock.unlock();
}
if(wasVisible) {
diff --git a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java
index ba5d09759..a85febca0 100644
--- a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java
@@ -71,6 +71,82 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 {
DisplayDriver.initSingleton();
}
+ /**
+ * First stage of selecting an Android PixelFormat,
+ * at construction via {@link SurfaceHolder#setFormat(int)}
+ * before native realization!
+ *
+ * @param rCaps requested Capabilities
+ * @return An Android PixelFormat number suitable for {@link SurfaceHolder#setFormat(int)}.
+ */
+ public static final int getSurfaceHolderFormat(CapabilitiesImmutable rCaps) {
+ int fmt = PixelFormat.UNKNOWN;
+
+ if( !rCaps.isBackgroundOpaque() ) {
+ fmt = PixelFormat.TRANSLUCENT;
+ } else if( rCaps.getRedBits()<=5 &&
+ rCaps.getGreenBits()<=6 &&
+ rCaps.getBlueBits()<=5 &&
+ rCaps.getAlphaBits()==0 ) {
+ fmt = PixelFormat.RGB_565;
+ } else if( rCaps.getAlphaBits()==0 ) {
+ fmt = PixelFormat.RGB_888;
+ } else {
+ fmt = PixelFormat.RGBA_8888;
+ }
+ Log.d(MD.TAG, "getSurfaceHolderFormat: requested: "+rCaps);
+ Log.d(MD.TAG, "getSurfaceHolderFormat: returned: "+fmt);
+
+ return fmt;
+ }
+
+
+ public static final int NATIVE_WINDOW_FORMAT_RGBA_8888 = 1;
+ public static final int NATIVE_WINDOW_FORMAT_RGBX_8888 = 2;
+ public static final int NATIVE_WINDOW_FORMAT_RGB_565 = 4;
+
+ /**
+ * Second stage of selecting an Android PixelFormat,
+ * at right after native (surface) realization at {@link Callback2#surfaceChanged(SurfaceHolder, int, int, int)}.
+ * Selection happens via {@link #setSurfaceVisualID0(long, int)} before native EGL creation.
+ *
+ * @param androidPixelFormat An Android PixelFormat delivered via {@link Callback2#surfaceChanged(SurfaceHolder, int, int, int)} params.
+ * @return A native Android PixelFormat number suitable for {@link #setSurfaceVisualID0(long, int)}.
+ */
+ public static final int getANativeWindowFormat(int androidPixelFormat) {
+ final int nativePixelFormat;
+ switch(androidPixelFormat) {
+ case PixelFormat.RGBA_8888:
+ case PixelFormat.RGBA_5551:
+ case PixelFormat.RGBA_4444:
+ nativePixelFormat = NATIVE_WINDOW_FORMAT_RGBA_8888;
+ break;
+
+ case PixelFormat.RGBX_8888:
+ case PixelFormat.RGB_888:
+ nativePixelFormat = NATIVE_WINDOW_FORMAT_RGBX_8888;
+ break;
+
+ case PixelFormat.RGB_565:
+ case PixelFormat.RGB_332:
+ nativePixelFormat = NATIVE_WINDOW_FORMAT_RGB_565;
+ break;
+ default: nativePixelFormat = NATIVE_WINDOW_FORMAT_RGBA_8888;
+ }
+ Log.d(MD.TAG, "getANativeWindowFormat: android: "+androidPixelFormat+" -> native "+nativePixelFormat);
+ return nativePixelFormat;
+ }
+
+ /**
+ * Final stage of Android PixelFormat operation,
+ * match the requested Capabilities w/ Android PixelFormat number.
+ * This is done at native realization @ {@link Callback2#surfaceChanged(SurfaceHolder, int, int, int)}.
+ *
+ * @param matchFormatPrecise
+ * @param format
+ * @param rCaps requested Capabilities
+ * @return The fixed Capabilities
+ */
public static final CapabilitiesImmutable fixCaps(boolean matchFormatPrecise, int format, CapabilitiesImmutable rCaps) {
PixelFormat pf = new PixelFormat();
PixelFormat.getPixelFormatInfo(format, pf);
@@ -78,10 +154,10 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 {
int r, g, b, a;
switch(format) {
- case PixelFormat.RGBA_8888: r=8; g=8; b=8; a=8; break;
- case PixelFormat.RGBX_8888: r=8; g=8; b=8; a=0; break;
+ case PixelFormat.RGBA_8888: r=8; g=8; b=8; a=8; break; // NATIVE_WINDOW_FORMAT_RGBA_8888
+ case PixelFormat.RGBX_8888: r=8; g=8; b=8; a=0; break; // NATIVE_WINDOW_FORMAT_RGBX_8888
case PixelFormat.RGB_888: r=8; g=8; b=8; a=0; break;
- case PixelFormat.RGB_565: r=5; g=6; b=5; a=0; break;
+ case PixelFormat.RGB_565: r=5; g=6; b=5; a=0; break; // NATIVE_WINDOW_FORMAT_RGB_565
case PixelFormat.RGBA_5551: r=5; g=5; b=5; a=1; break;
case PixelFormat.RGBA_4444: r=4; g=4; b=4; a=4; break;
case PixelFormat.RGB_332: r=3; g=3; b=2; a=0; break;
@@ -110,32 +186,6 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 {
return res;
}
- public static final int getFormat(CapabilitiesImmutable rCaps) {
- int fmt = PixelFormat.UNKNOWN;
-
- if(!rCaps.isBackgroundOpaque()) {
- fmt = PixelFormat.TRANSLUCENT;
- } else if(rCaps.getRedBits()<=5 &&
- rCaps.getGreenBits()<=6 &&
- rCaps.getBlueBits()<=5 &&
- rCaps.getAlphaBits()==0) {
- fmt = PixelFormat.RGB_565;
- }
- /* else if(rCaps.getRedBits()<=5 &&
- rCaps.getGreenBits()<=5 &&
- rCaps.getBlueBits()<=5 &&
- rCaps.getAlphaBits()==1) {
- fmt = PixelFormat.RGBA_5551; // FIXME: Supported ?
- } */
- else {
- fmt = PixelFormat.RGBA_8888;
- }
- Log.d(MD.TAG, "getFormat: requested: "+rCaps);
- Log.d(MD.TAG, "getFormat: returned: "+fmt);
-
- return fmt;
- }
-
public static final boolean isAndroidFormatTransparent(int aFormat) {
switch (aFormat) {
case PixelFormat.TRANSLUCENT:
@@ -195,12 +245,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 {
final SurfaceHolder sh = androidView.getHolder();
sh.addCallback(WindowDriver.this);
- sh.setFormat(getFormat(getRequestedCapabilities()));
- }
- private final void removeAndroidView() {
- final SurfaceHolder sh = androidView.getHolder();
- sh.removeCallback(WindowDriver.this);
- androidView = null;
+ sh.setFormat(getSurfaceHolderFormat(getRequestedCapabilities()));
}
public final SurfaceView getAndroidView() { return androidView; }
@@ -287,6 +332,8 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 {
}
final int nativeVisualID = eglConfig.getVisualID(VisualIDHolder.VIDType.NATIVE);
Log.d(MD.TAG, "nativeVisualID 0x"+Integer.toHexString(nativeVisualID));
+ Log.d(MD.TAG, "requestedCaps: "+eglConfig.getRequestedCapabilities());
+ Log.d(MD.TAG, "chosenCaps : "+eglConfig.getChosenCapabilities());
if(VisualIDHolder.VID_UNDEFINED != nativeVisualID) {
setSurfaceVisualID0(surfaceHandle, nativeVisualID);
}
@@ -334,16 +381,11 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 {
if( null != viewGroup) {
viewGroup.post(new Runnable() {
public void run() {
- if(null == androidView) {
- final Context ctx = StaticContext.getContext();
- setupAndroidView(ctx);
- }
viewGroup.removeView(androidView);
Log.d(MD.TAG, "closeNativeImpl: removed from static ViewGroup - on thread "+Thread.currentThread().getName());
} });
}
}
- removeAndroidView();
}
surface = null;
@@ -504,7 +546,11 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 {
surface = aHolder.getSurface();
surfaceHandle = getSurfaceHandle0(surface);
acquire0(surfaceHandle);
+ final int aNativeWindowFormat = getANativeWindowFormat(androidFormat);
+ setSurfaceVisualID0(surfaceHandle, aNativeWindowFormat);
nativeFormat = getSurfaceVisualID0(surfaceHandle);
+ Log.d(MD.TAG, "surfaceChanged: androidFormat "+androidFormat+" -- (set-native "+aNativeWindowFormat+") --> nativeFormat "+nativeFormat);
+
final int nWidth = getWidth0(surfaceHandle);
final int nHeight = getHeight0(surfaceHandle);
capsByFormat = (GLCapabilitiesImmutable) fixCaps(true /* matchFormatPrecise */, nativeFormat, getRequestedCapabilities());
@@ -560,7 +606,9 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 {
//
protected static native boolean initIDs0();
protected static native long getSurfaceHandle0(Surface surface);
+ /** Return the native window format via <code>ANativeWindow_getFormat(..)</code>. */
protected static native int getSurfaceVisualID0(long surfaceHandle);
+ /** Set the native window format via <code>ANativeWindow_setBuffersGeometry(..)</code>. */
protected static native void setSurfaceVisualID0(long surfaceHandle, int nativeVisualID);
protected static native int getWidth0(long surfaceHandle);
protected static native int getHeight0(long surfaceHandle);
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java
index 4468868f6..e782ac75f 100644
--- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java
+++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java
@@ -47,6 +47,9 @@ import android.util.Log;
public class NEWTGearsES2Activity extends NewtBaseActivity {
static String TAG = "NEWTGearsES2Activity";
+ static final String forceRGBA5650 = "demo.force.rgba5650";
+ static final String forceECT = "demo.force.ect";
+
@Override
public void onCreate(Bundle savedInstanceState) {
Log.d(TAG, "onCreate - 0");
@@ -54,6 +57,11 @@ public class NEWTGearsES2Activity extends NewtBaseActivity {
// create GLWindow (-> incl. underlying NEWT Display, Screen & Window)
GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2));
+ if( null != System.getProperty(forceRGBA5650) ) {
+ Log.d(TAG, "forceRGBA5650");
+ caps.setRedBits(5); caps.setGreenBits(6); caps.setBlueBits(5);
+ }
+
Log.d(TAG, "req caps: "+caps);
GLWindow glWindow = GLWindow.create(caps);
glWindow.setFullscreen(true);
@@ -81,6 +89,11 @@ public class NEWTGearsES2Activity extends NewtBaseActivity {
setAnimator(animator);
// glWindow.setSkipContextReleaseThread(animator.getThread());
+ if( null != System.getProperty(forceECT) ) {
+ Log.d(TAG, "forceECT");
+ animator.setExclusiveContext(true);
+ }
+
glWindow.setVisible(true);
animator.setUpdateFPSFrames(60, System.err);
@@ -88,5 +101,5 @@ public class NEWTGearsES2Activity extends NewtBaseActivity {
glWindow.resetFPSCounter();
Log.d(TAG, "onCreate - X");
- }
+ }
}
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ECTActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ECTActivityLauncher.java
new file mode 100644
index 000000000..c54aa0fa6
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ECTActivityLauncher.java
@@ -0,0 +1,75 @@
+/**
+ * Copyright 2012 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 java.util.Arrays;
+import java.util.List;
+
+import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties;
+
+public class NEWTGearsES2ECTActivityLauncher extends LauncherUtil.BaseActivityLauncher {
+
+ static String demo = "com.jogamp.opengl.test.android.NEWTGearsES2Activity";
+ // static String[] pkgs = new String[] { "com.jogamp.common", "javax.media.opengl", "com.jogamp.opengl.test" };
+ static String[] pkgs = new String[] { "com.jogamp.opengl.test" };
+
+ @Override
+ public void init() {
+ final OrderedProperties props = getProperties();
+ // props.setProperty("jogamp.debug.JNILibLoader", "true");
+ // props.setProperty("jogamp.debug.NativeLibrary", "true");
+ // props.setProperty("jogamp.debug.IOUtil", "true");
+ // properties.setProperty("jogamp.debug.NativeLibrary.Lookup", "true");
+ // props.setProperty("nativewindow.debug", "all");
+ props.setProperty("nativewindow.debug.GraphicsConfiguration", "true");
+ // props.setProperty("jogl.debug", "all");
+ // properties.setProperty("jogl.debug.GLProfile", "true");
+ // props.setProperty("jogl.debug.GLDrawable", "true");
+ props.setProperty("jogl.debug.GLContext", "true");
+ props.setProperty("jogl.debug.GLSLCode", "true");
+ // props.setProperty("jogl.debug.CapabilitiesChooser", "true");
+ // props.setProperty("jogl.debug.GLSLState", "true");
+ // props.setProperty("jogl.debug.DebugGL", "true");
+ // props.setProperty("jogl.debug.TraceGL", "true");
+ // props.setProperty("newt.debug", "all");
+ props.setProperty("newt.debug.Window", "true");
+ props.setProperty("newt.debug.Window.MouseEvent", "true");
+ props.setProperty("newt.debug.Window.KeyEvent", "true");
+
+ props.setProperty("demo.force.ect", "true");
+ }
+
+ @Override
+ public String getActivityName() {
+ return demo;
+ }
+ @Override
+ public List<String> getPackages() {
+ return Arrays.asList(pkgs);
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2RGB565ActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2RGB565ActivityLauncher.java
new file mode 100644
index 000000000..fbd9b0a9c
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2RGB565ActivityLauncher.java
@@ -0,0 +1,75 @@
+/**
+ * Copyright 2012 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 java.util.Arrays;
+import java.util.List;
+
+import com.jogamp.opengl.test.android.LauncherUtil.OrderedProperties;
+
+public class NEWTGearsES2RGB565ActivityLauncher extends LauncherUtil.BaseActivityLauncher {
+
+ static String demo = "com.jogamp.opengl.test.android.NEWTGearsES2Activity";
+ // static String[] pkgs = new String[] { "com.jogamp.common", "javax.media.opengl", "com.jogamp.opengl.test" };
+ static String[] pkgs = new String[] { "com.jogamp.opengl.test" };
+
+ @Override
+ public void init() {
+ final OrderedProperties props = getProperties();
+ // props.setProperty("jogamp.debug.JNILibLoader", "true");
+ // props.setProperty("jogamp.debug.NativeLibrary", "true");
+ // props.setProperty("jogamp.debug.IOUtil", "true");
+ // properties.setProperty("jogamp.debug.NativeLibrary.Lookup", "true");
+ // props.setProperty("nativewindow.debug", "all");
+ props.setProperty("nativewindow.debug.GraphicsConfiguration", "true");
+ // props.setProperty("jogl.debug", "all");
+ // properties.setProperty("jogl.debug.GLProfile", "true");
+ // props.setProperty("jogl.debug.GLDrawable", "true");
+ props.setProperty("jogl.debug.GLContext", "true");
+ props.setProperty("jogl.debug.GLSLCode", "true");
+ // props.setProperty("jogl.debug.CapabilitiesChooser", "true");
+ // props.setProperty("jogl.debug.GLSLState", "true");
+ // props.setProperty("jogl.debug.DebugGL", "true");
+ // props.setProperty("jogl.debug.TraceGL", "true");
+ // props.setProperty("newt.debug", "all");
+ props.setProperty("newt.debug.Window", "true");
+ props.setProperty("newt.debug.Window.MouseEvent", "true");
+ props.setProperty("newt.debug.Window.KeyEvent", "true");
+
+ props.setProperty("demo.force.rgba5650", "true");
+ }
+
+ @Override
+ public String getActivityName() {
+ return demo;
+ }
+ @Override
+ public List<String> getPackages() {
+ return Arrays.asList(pkgs);
+ }
+}