diff options
-rw-r--r-- | src/jogl/native/macosx/MacOSXWindowSystemInterface-pbuffer.m | 15 | ||||
-rw-r--r-- | src/nativewindow/native/macosx/OSXmisc.m | 35 |
2 files changed, 28 insertions, 22 deletions
diff --git a/src/jogl/native/macosx/MacOSXWindowSystemInterface-pbuffer.m b/src/jogl/native/macosx/MacOSXWindowSystemInterface-pbuffer.m index 47f679fac..34bf213ab 100644 --- a/src/jogl/native/macosx/MacOSXWindowSystemInterface-pbuffer.m +++ b/src/jogl/native/macosx/MacOSXWindowSystemInterface-pbuffer.m @@ -97,6 +97,11 @@ static CVReturn renderMyNSOpenGLLayer(CVDisplayLinkRef displayLink, pthread_mutex_init(&renderLock, NULL); // fast non-recursive pthread_cond_init(&renderSignal, NULL); // no attribute + // no animations for add/remove/swap sublayers etc + [self removeAnimationForKey: kCAOnOrderIn]; + [self removeAnimationForKey: kCAOnOrderOut]; + [self removeAnimationForKey: kCATransition]; + pbuffer = p; [pbuffer retain]; @@ -201,6 +206,8 @@ static CVReturn renderMyNSOpenGLLayer(CVDisplayLinkRef displayLink, - (void)dealloc { DBG_PRINT("MyNSOpenGLLayer::dealloc.0 %p (refcnt %d)\n", self, (int)[self retainCount]); + // NSLog(@"MyNSOpenGLLayer::dealloc: %@",[NSThread callStackSymbols]); + [self disableAnimation]; [self deallocTex]; pthread_cond_destroy(&renderSignal); @@ -229,7 +236,6 @@ static CVReturn renderMyNSOpenGLLayer(CVDisplayLinkRef displayLink, forLayerTime:(CFTimeInterval)timeInterval displayTime:(const CVTimeStamp *)timeStamp { [context makeCurrentContext]; - // FIXME ?? [context update]; /** * v-sync doesn't works w/ NSOpenGLLayer's context .. well :( @@ -261,13 +267,6 @@ static CVReturn renderMyNSOpenGLLayer(CVDisplayLinkRef displayLink, CGRect lRect = [self frame]; DBG_PRINT("MyNSOpenGLLayer::drawInOpenGLContext %p frame0: %lf/%lf %lfx%lf\n", self, lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height); - if(lRect.origin.x<0 || lRect.origin.y<0) { - lRect.origin.x = 0; - lRect.origin.y = 0; - [self setFrame: lRect]; - DBG_PRINT("MyNSOpenGLLayer::drawInOpenGLContext %p frame*: %lf/%lf %lfx%lf\n", - self, lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height); - } } glBindTexture(textureTarget, textureID); diff --git a/src/nativewindow/native/macosx/OSXmisc.m b/src/nativewindow/native/macosx/OSXmisc.m index d7a2feff3..58e8b256d 100644 --- a/src/nativewindow/native/macosx/OSXmisc.m +++ b/src/nativewindow/native/macosx/OSXmisc.m @@ -40,7 +40,7 @@ #include <jawt_md.h> #import <JavaNativeFoundation.h> -// #define VERBOSE 1 +#define VERBOSE 1 // #ifdef VERBOSE // #define DBG_PRINT(...) NSLog(@ ## __VA_ARGS__) @@ -202,10 +202,6 @@ JNIEXPORT jlong JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_CreateNSWindow0 [myWindow setOpaque: NO]; [myWindow setBackgroundColor: [NSColor clearColor]]; - // force surface creation - // [myView lockFocus]; - // [myView unlockFocus]; - [pool release]; return (jlong) ((intptr_t) myWindow); @@ -221,13 +217,7 @@ JNIEXPORT void JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_DestroyNSWindow0 { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NSWindow* mWin = (NSWindow*) ((intptr_t) nsWindow); - NSView* mView = [mWin contentView]; - if(NULL!=mView) { - [mWin setContentView: nil]; - [mView release]; - } - [mWin orderOut: mWin]; [mWin close]; // performs release! [pool release]; } @@ -245,6 +235,11 @@ JNIEXPORT jlong JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_CreateCALayer0 // CALayer* layer = [[CALayer alloc] init]; CALayer* layer = [CALayer layer]; + // no animations for add/remove/swap sublayers etc + [layer removeAnimationForKey: kCAOnOrderIn]; + [layer removeAnimationForKey: kCAOnOrderOut]; + [layer removeAnimationForKey: kCATransition]; + // initial dummy size ! CGRect lRect = [layer frame]; lRect.origin.x = 0; @@ -272,11 +267,23 @@ JNIEXPORT void JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_AddCASublayer0 CALayer* subLayer = (CALayer*) ((intptr_t) subCALayer); CGRect lRectRoot = [rootLayer frame]; - // simple 1:1 layout ! - [subLayer setFrame:lRectRoot]; - DBG_PRINT("CALayer::AddCASublayer0.0: %p . %p %lf/%lf %lfx%lf (refcnt %d)\n", + DBG_PRINT("CALayer::AddCASublayer0.0: Origin %p frame0: %lf/%lf %lfx%lf\n", + rootLayer, lRectRoot.origin.x, lRectRoot.origin.y, lRectRoot.size.width, lRectRoot.size.height); + if(lRectRoot.origin.x<0 || lRectRoot.origin.y<0) { + lRectRoot.origin.x = 0; + lRectRoot.origin.y = 0; + [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){ + [rootLayer setFrame: lRectRoot]; + }]; + DBG_PRINT("CALayer::AddCASublayer0.1: Origin %p frame*: %lf/%lf %lfx%lf\n", + rootLayer, lRectRoot.origin.x, lRectRoot.origin.y, lRectRoot.size.width, lRectRoot.size.height); + } + DBG_PRINT("CALayer::AddCASublayer0.2: %p . %p %lf/%lf %lfx%lf (refcnt %d)\n", rootLayer, subLayer, lRectRoot.origin.x, lRectRoot.origin.y, lRectRoot.size.width, lRectRoot.size.height, (int)[subLayer retainCount]); + [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){ + // simple 1:1 layout ! + [subLayer setFrame:lRectRoot]; [rootLayer addSublayer:subLayer]; }]; DBG_PRINT("CALayer::AddCASublayer0.X: %p . %p (refcnt %d)\n", rootLayer, subLayer, (int)[subLayer retainCount]); |