diff options
author | Sven Gothel <[email protected]> | 2012-11-04 06:42:43 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-11-04 06:42:43 +0100 |
commit | 808c8da0729b845d010d3f5e0babf1fc6129c3e9 (patch) | |
tree | f1ab90439492865de1aa507f4807f8cc96c4a6d4 /src/jogl/native/macosx | |
parent | 502847f59ef01c78a85e4ee5453a09d9b83d9a5e (diff) |
MacOSXCGLContext[NSOpenGLLayer/NSView]: Propagate drawable change
Propagate drawable change to MacOSXCGLContext where either context/NSView or context/NSOpenGLLayer
association needs to get updated.
Fixes drawable/context switch.
Diffstat (limited to 'src/jogl/native/macosx')
-rw-r--r-- | src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m | 1 | ||||
-rw-r--r-- | src/jogl/native/macosx/MacOSXWindowSystemInterface.m | 13 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m b/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m index 6ebf400e2..b37930587 100644 --- a/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m +++ b/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m @@ -448,6 +448,7 @@ static const GLfloat gl_verts[] = { [self disableAnimation]; [self deallocPBuffer]; [[self openGLContext] release]; + [parentPixelFmt release]; [self release]; DBG_PRINT("MyNSOpenGLLayer::releaseLayer.X: %p (refcnt %d)\n", self, (int)[self retainCount]); pthread_mutex_unlock(&renderLock); diff --git a/src/jogl/native/macosx/MacOSXWindowSystemInterface.m b/src/jogl/native/macosx/MacOSXWindowSystemInterface.m index 48807ee29..e8925f8e8 100644 --- a/src/jogl/native/macosx/MacOSXWindowSystemInterface.m +++ b/src/jogl/native/macosx/MacOSXWindowSystemInterface.m @@ -551,8 +551,7 @@ NSOpenGLContext* createContext(NSOpenGLContext* share, NSOpenGLContext* ctx = [[NSOpenGLContext alloc] initWithFormat:fmt shareContext:share]; - if (ctx != nil) { - if (view != nil) { + if ( nil != ctx && nil != view ) { if(!opaque) { GLint zeroOpacity = 0; [ctx setValues:&zeroOpacity forParameter:NSOpenGLCPSurfaceOpacity]; @@ -563,7 +562,6 @@ NSOpenGLContext* createContext(NSOpenGLContext* share, DBG_PRINT("createContext.3.X: setView\n"); [view unlockFocus]; } - } } DBG_PRINT("createContext.X: ctx: %p\n", ctx); @@ -571,6 +569,15 @@ NSOpenGLContext* createContext(NSOpenGLContext* share, return ctx; } +void setContextView(NSOpenGLContext* ctx, NSView* view) { + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; + if ( nil != ctx && nil != view ) { + [ctx setView:view]; + } + [pool release]; + return ctx; +} + Bool makeCurrentContext(NSOpenGLContext* ctx) { #if 0 // we issue the CGL Lock from Java upfront! |