diff options
Diffstat (limited to 'src')
3 files changed, 29 insertions, 2 deletions
diff --git a/src/native/jogl/MacOSXWindowSystemInterface.m b/src/native/jogl/MacOSXWindowSystemInterface.m index ceb07a63d..3d852571c 100644 --- a/src/native/jogl/MacOSXWindowSystemInterface.m +++ b/src/native/jogl/MacOSXWindowSystemInterface.m @@ -96,6 +96,14 @@ Bool flushBuffer(void* context, void* view) return true; } +void updateContext(void* context, void* view) +{ +//fprintf(stderr, "updateContext context=%p, view=%p\n", context, view); + NSOpenGLContext *nsContext = (NSOpenGLContext*)context; + + [nsContext update]; +} + void* updateContextRegister(void* context, void* view) { //fprintf(stderr, "updateContextRegister context=%p, view=%p\n", context, view); diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java b/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java index e6169a4b9..e1618a15a 100644 --- a/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java +++ b/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java @@ -108,7 +108,7 @@ public abstract class MacOSXGLContext extends GLContext if (nsContext == 0) { throw new GLException("Error creating nsContext"); } - updater = CGL.updateContextRegister(nsContext, nsView); + //updater = CGL.updateContextRegister(nsContext, nsView); // gznote: not thread safe yet! GLContextShareSet.contextCreated(this); } diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java b/src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java index ec46de0d8..97020de28 100644 --- a/src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java +++ b/src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java @@ -50,6 +50,7 @@ public class MacOSXOnscreenGLContext extends MacOSXGLContext { private JAWT_DrawingSurface ds; private JAWT_DrawingSurfaceInfo dsi; private JAWT_MacOSXDrawingSurfaceInfo macosxdsi; + private Runnable myDeferredReshapeAction; // Variables for pbuffer support List pbuffersToInstantiate = new ArrayList(); @@ -61,6 +62,24 @@ public class MacOSXOnscreenGLContext extends MacOSXGLContext { super(component, capabilities, chooser, shareWith); } + // gznote: remove when updater is thread safe! + public synchronized void invokeGL(final Runnable runnable, boolean isReshape, Runnable initAction) throws GLException { + if (isReshape) { + myDeferredReshapeAction = new Runnable() { + public void run() { + CGL.updateContext(nsContext, nsView); + runnable.run(); + } + }; + } else { + if (myDeferredReshapeAction != null) { + super.invokeGL(myDeferredReshapeAction, true, initAction); + myDeferredReshapeAction = null; + } + super.invokeGL(runnable, isReshape, initAction); + } + } + protected GL createGL() { return new MacOSXGLImpl(this); } @@ -167,7 +186,7 @@ public class MacOSXOnscreenGLContext extends MacOSXGLContext { // OpenGL nsContext so it will be recreated if ((res & JAWTFactory.JAWT_LOCK_SURFACE_CHANGED) != 0) { if (nsContext != 0) { - CGL.updateContextUnregister(nsContext, nsView, updater); + //CGL.updateContextUnregister(nsContext, nsView, updater); // gznote: not thread safe yet! if (!CGL.deleteContext(nsContext, nsView)) { throw new GLException("Unable to delete old GL nsContext after surface changed"); } |