From 573fa2182404924286987ea487c94531258d654e Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Thu, 7 Apr 2005 07:24:58 +0000 Subject: Attempted to work around bugs seen during resizing of GLCanvas on Mac OS X by updating the context during every makeCurrent, not just upon reshape. This appears to solve some issues without impacting performance significantly, although not all of the issues reported by users were reproducible on the machine where the fixes were tested. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@255 232f8b59-042b-4e1e-8c03-345bb8c30851 --- .../jogl/impl/macosx/MacOSXOnscreenGLContext.java | 27 +++++++--------------- 1 file changed, 8 insertions(+), 19 deletions(-) (limited to 'src/net') diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java b/src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java index e957092ee..401a657fe 100644 --- a/src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java +++ b/src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java @@ -52,7 +52,6 @@ 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(); @@ -67,24 +66,6 @@ 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 boolean isOffscreen() { return false; } @@ -136,6 +117,14 @@ public class MacOSXOnscreenGLContext extends MacOSXGLContext { } boolean ret = super.makeCurrent(initAction); if (ret) { + // Assume the canvas might have been resized or moved and tell the OpenGL + // context to update itself. This used to be done only upon receiving a + // reshape event but that doesn't appear to be sufficient. An experiment + // was also done to add a HierarchyBoundsListener to the GLCanvas and + // do this updating only upon reshape of this component or reshape or movement + // of an ancestor, but this also wasn't sufficient and left garbage on the + // screen in some situations. + CGL.updateContext(nsContext, nsView); // Instantiate any pending pbuffers while (!pbuffersToInstantiate.isEmpty()) { MacOSXPbufferGLContext ctx = -- cgit v1.2.3