From e509bac8554b5a5e8a7cec6638aad53c4129eb68 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 21 Nov 2019 02:58:31 +0100 Subject: IOS: CGL.updateContextRegister(..) call on main-thread using AppKit --- .../jogamp/opengl/macosx/cgl/MacOSXCGLContext.java | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src') 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); + } } } } -- cgit v1.2.3