diff options
author | Sven Gothel <[email protected]> | 2019-11-21 02:58:31 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2019-11-21 02:58:31 +0100 |
commit | e509bac8554b5a5e8a7cec6638aad53c4129eb68 (patch) | |
tree | 82aa1721954df7ebac454461b7516bd3dcd18e6e /src | |
parent | 1e48668514c2f9c6120b62f1a66b87422e511627 (diff) |
IOS: CGL.updateContextRegister(..) call on main-thread using AppKit
Diffstat (limited to 'src')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java index 718216315..ce4f216cd 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java @@ -356,7 +356,16 @@ public class MacOSXCGLContext extends GLContextImpl incompleteView = false; } if(!incompleteView) { - updateHandle = CGL.updateContextRegister(contextHandle, drawable.getHandle()); + if( useAppKit ) { + OSXUtil.RunOnMainThread(true, false, new Runnable() { + @Override + public void run() { + updateHandle = CGL.updateContextRegister(contextHandle, drawable.getHandle()); + } + }); + } else { + updateHandle = CGL.updateContextRegister(contextHandle, drawable.getHandle()); + } if(0 == updateHandle) { throw new InternalError("XXX2"); } @@ -373,6 +382,7 @@ public class MacOSXCGLContext extends GLContextImpl } } + private static boolean useAppKit = false; @Override protected void drawableUpdatedNotify() throws GLException { if( drawable.getChosenGLCapabilities().isOnscreen() ) { @@ -387,7 +397,16 @@ public class MacOSXCGLContext extends GLContextImpl if (contextHandle == 0) { throw new GLException("Context not created"); } - CGL.updateContext(contextHandle); + if( useAppKit ) { + OSXUtil.RunOnMainThread(true, false, new Runnable() { + @Override + public void run() { + CGL.updateContext(contextHandle); + } + }); + } else { + CGL.updateContext(contextHandle); + } } } } |