summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/demos/com/jogamp/opengl/demos/ios/Hello.java4
-rw-r--r--src/demos/com/jogamp/opengl/demos/ios/Hello1.java2
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/ios/IOSDummyUpstreamSurfaceHook.java2
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/ios/IOSUtil.java6
-rw-r--r--src/nativewindow/native/ios/IOSmisc.m27
-rw-r--r--src/newt/native/IOSWindow.m19
6 files changed, 46 insertions, 14 deletions
diff --git a/src/demos/com/jogamp/opengl/demos/ios/Hello.java b/src/demos/com/jogamp/opengl/demos/ios/Hello.java
index 378868bea..5750c7b90 100644
--- a/src/demos/com/jogamp/opengl/demos/ios/Hello.java
+++ b/src/demos/com/jogamp/opengl/demos/ios/Hello.java
@@ -67,6 +67,7 @@ public class Hello {
int secondsDuration = 10; // 10s
int width = 832, height = 480; // ipad pro 11: 2388x1668 px (scale: 2)
int fboDepthBits = -1; // CAEAGLLayer fails with depth 16 + 24 in Simulation; -1 means don't change
+ boolean translucent = false;
boolean exitJVM = false;
String demoName = "com.jogamp.opengl.demos.es2.GearsES2";
for(int i=0; i<args.length; i++) {
@@ -85,6 +86,8 @@ public class Hello {
reqSurfacePixelScale[1] = reqSurfacePixelScale[0];
} else if(args[i].equals("-seconds") && i+1<args.length) {
secondsDuration = parseInt(args[++i], secondsDuration);
+ } else if(args[i].equals("-translucent")) {
+ translucent = true;
} else {
System.err.println("ignoring arg["+i+"]: "+args[i]);
}
@@ -131,6 +134,7 @@ public class Hello {
if( 0 <= fboDepthBits) {
reqCaps.setDepthBits(fboDepthBits);
}
+ reqCaps.setBackgroundOpaque(!translucent);
System.out.println("Requested GL Caps: "+reqCaps);
// 2) Create newt native window
diff --git a/src/demos/com/jogamp/opengl/demos/ios/Hello1.java b/src/demos/com/jogamp/opengl/demos/ios/Hello1.java
index e0c3be871..5dc7b14a2 100644
--- a/src/demos/com/jogamp/opengl/demos/ios/Hello1.java
+++ b/src/demos/com/jogamp/opengl/demos/ios/Hello1.java
@@ -117,7 +117,7 @@ public class Hello1 {
System.err.println("");
GLAutoDrawableDelegate glad = null;
- final long uiWindow = IOSUtil.CreateUIWindow(0, 0, width, height);
+ final long uiWindow = IOSUtil.CreateUIWindow(0, 0, width, height, true);
try {
// 1) Config ..
final GLProfile glp = GLProfile.getGL2ES2();
diff --git a/src/nativewindow/classes/jogamp/nativewindow/ios/IOSDummyUpstreamSurfaceHook.java b/src/nativewindow/classes/jogamp/nativewindow/ios/IOSDummyUpstreamSurfaceHook.java
index a61287f8b..079f6c5a8 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/ios/IOSDummyUpstreamSurfaceHook.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/ios/IOSDummyUpstreamSurfaceHook.java
@@ -53,7 +53,7 @@ public class IOSDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize
@Override
public final void create(final ProxySurface s) {
if(0 == uiWindow && 0 == s.getSurfaceHandle()) {
- uiWindow = IOSUtil.CreateUIWindow(0, 0, 64, 64);
+ uiWindow = IOSUtil.CreateUIWindow(0, 0, 64, 64, false);
if(0 == uiWindow) {
throw new NativeWindowException("Error UI window 0");
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/ios/IOSUtil.java b/src/nativewindow/classes/jogamp/nativewindow/ios/IOSUtil.java
index 7100cb0b5..4790f21da 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/ios/IOSUtil.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/ios/IOSUtil.java
@@ -130,12 +130,12 @@ public class IOSUtil implements ToolkitProperties {
}
}
- public static long CreateUIWindow(final int x, final int y, final int width, final int height) {
+ public static long CreateUIWindow(final int x, final int y, final int width, final int height, final boolean visible) {
final long res[] = { 0 };
RunOnMainThread(true, false /* kickNSApp */, new Runnable() {
@Override
public void run() {
- res[0] = CreateUIWindow0(x, y, width, height);
+ res[0] = CreateUIWindow0(x, y, width, height, visible);
} } );
return res[0];
}
@@ -312,7 +312,7 @@ public class IOSUtil implements ToolkitProperties {
private static native Object GetInsets0(long windowOrView);
private static native float GetScreenPixelScale1(int screenIdx);
private static native float GetScreenPixelScale2(long windowOrView);
- private static native long CreateUIWindow0(int x, int y, int width, int height);
+ private static native long CreateUIWindow0(int x, int y, int width, int height, boolean visible);
private static native void DestroyUIWindow0(long uiWindow);
private static native long GetCALayer0(long uiView);
private static native long GetCAEAGLLayer0(long uiView);
diff --git a/src/nativewindow/native/ios/IOSmisc.m b/src/nativewindow/native/ios/IOSmisc.m
index 1983143df..9a1bbfd7f 100644
--- a/src/nativewindow/native/ios/IOSmisc.m
+++ b/src/nativewindow/native/ios/IOSmisc.m
@@ -315,7 +315,7 @@ JNIEXPORT jfloat JNICALL Java_jogamp_nativewindow_ios_IOSUtil_GetScreenPixelScal
* Signature: (IIIIZ)J
*/
JNIEXPORT jlong JNICALL Java_jogamp_nativewindow_ios_IOSUtil_CreateUIWindow0
- (JNIEnv *env, jclass unused, jint x, jint y, jint width, jint height)
+ (JNIEnv *env, jclass unused, jint x, jint y, jint width, jint height, jboolean visible)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
[CATransaction begin];
@@ -325,22 +325,33 @@ JNIEXPORT jlong JNICALL Java_jogamp_nativewindow_ios_IOSUtil_CreateUIWindow0
// Allocate the window
UIWindow *myWindow = [[[[UIWindow alloc] initWithFrame:boundsWin] autorelease] retain];
myWindow.rootViewController = [[[UIViewController alloc] initWithNibName:nil bundle:nil] autorelease];
+#ifdef VERBOSE_ON
[myWindow setBackgroundColor: [UIColor redColor]];
+#endif
// n/a iOS [myWindow setPreservesContentDuringLiveResize: YES];
- // FIXME invisible .. (we keep it visible for testing)
- // FIXME [myWindow setOpaque: NO];
- // FIXME [myWindow setBackgroundColor: [UIColor clearColor]];
- [myWindow makeKeyAndVisible];
-
+ if( visible) {
+ [myWindow setOpaque: YES];
+ [myWindow makeKeyAndVisible];
+ } else {
+ [myWindow setOpaque: NO];
+ [myWindow setBackgroundColor: [UIColor clearColor]];
+ }
CAEAGLUIView *uiView = [[CAEAGLUIView alloc] initWithFrame:boundsView];
CAEAGLLayer* l = (CAEAGLLayer*)[uiView layer];
- [l setOpaque: YES];
+ if( visible ) {
+ [uiView setOpaque: YES];
+ [l setOpaque: YES];
+ } else {
+ [uiView setOpaque: NO];
+ [uiView setBackgroundColor: [UIColor clearColor]];
+ [l setOpaque: NO];
+ [l setBackgroundColor: [UIColor clearColor]];
+ }
l.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys: /* defaults */
[NSNumber numberWithBool:NO], kEAGLDrawablePropertyRetainedBacking, kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil];
-
[myWindow addSubview: uiView];
[CATransaction commit];
diff --git a/src/newt/native/IOSWindow.m b/src/newt/native/IOSWindow.m
index 4e3bd5479..b953c3146 100644
--- a/src/newt/native/IOSWindow.m
+++ b/src/newt/native/IOSWindow.m
@@ -517,7 +517,15 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_ios_WindowDriver_createWindow1
backing: 0 // TODO (NSBackingStoreType) bufferingType
defer: YES
isFullscreenWindow: fullscreen] autorelease] retain];
- [myWindow setBackgroundColor: [UIColor redColor]];
+ if(opaque) {
+ [myWindow setOpaque: YES];
+#ifdef VERBOSE_ON
+ [myWindow setBackgroundColor: [UIColor redColor]];
+#endif
+ } else {
+ [myWindow setOpaque: NO];
+ [myWindow setBackgroundColor: [UIColor clearColor]];
+ }
if( visible ) {
// Only if calling this before adding the view, the view receives touch events.
// Another 'funny' iOS API nightmare?
@@ -530,6 +538,15 @@ JNIEXPORT jlong JNICALL Java_jogamp_newt_driver_ios_WindowDriver_createWindow1
myView = [[NewtUIView alloc] initWithFrame: rectView] ;
}
CAEAGLLayer* l = (CAEAGLLayer*)[myView layer];
+ if(opaque) {
+ [myView setOpaque: YES];
+ [l setOpaque: YES];
+ } else {
+ [myView setOpaque: NO];
+ [myView setBackgroundColor: [UIColor clearColor]];
+ [l setOpaque: NO];
+ [l setBackgroundColor: [UIColor clearColor]];
+ }
DBG_PRINT_CREATEWIN1(2);
changeContentView(env, jthis, parentView, myWindow, myView, NO);