diff options
Diffstat (limited to 'src/net/java/games/jogl/impl')
6 files changed, 41 insertions, 20 deletions
diff --git a/src/net/java/games/jogl/impl/GLContext.java b/src/net/java/games/jogl/impl/GLContext.java index 17667fbce..318ff24a2 100644 --- a/src/net/java/games/jogl/impl/GLContext.java +++ b/src/net/java/games/jogl/impl/GLContext.java @@ -552,6 +552,13 @@ public abstract class GLContext { */ public abstract void releasePbufferFromTexture(); + /* + * Sets the swap interval for onscreen OpenGL contexts. Has no + * effect for offscreen contexts. + */ + public void setSwapInterval(final int interval) { + } + /** Maps the given "platform-independent" function name to a real function name. Currently this is only used to map "glAllocateMemoryNV" and associated routines to wglAllocateMemoryNV / glXAllocateMemoryNV. */ diff --git a/src/net/java/games/jogl/impl/SingleThreadedWorkaround.java b/src/net/java/games/jogl/impl/SingleThreadedWorkaround.java index 7b9fa46c4..ff79b5c6e 100755 --- a/src/net/java/games/jogl/impl/SingleThreadedWorkaround.java +++ b/src/net/java/games/jogl/impl/SingleThreadedWorkaround.java @@ -85,6 +85,17 @@ public class SingleThreadedWorkaround { }); } + /** Public method for users to disable the single-threaded + workaround in application code. Should perhaps eventually + promote this method to the public API. */ + public static void disableWorkaround() { + systemPropertySpecified = true; + singleThreadedWorkaround = false; + if (Debug.verbose()) { + System.err.println("Application forced disabling of single-threaded workaround of dispatching display() on event thread"); + } + } + public static void shouldDoWorkaround() { if (!systemPropertySpecified) { singleThreadedWorkaround = true; diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java b/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java index 3c8027e7c..cfa5c3d99 100644 --- a/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java +++ b/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java @@ -227,6 +227,13 @@ public abstract class MacOSXGLContext extends GLContext return ""; } + public void setSwapInterval(int interval) { + if (nsContext == 0) { + throw new GLException("OpenGL context not current"); + } + CGL.setSwapInterval(nsContext, interval); + } + //---------------------------------------------------------------------- // Internals only below this point // 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 = diff --git a/src/net/java/games/jogl/impl/tesselator/Sweep.java b/src/net/java/games/jogl/impl/tesselator/Sweep.java index e7b77cd26..3674d12e1 100644 --- a/src/net/java/games/jogl/impl/tesselator/Sweep.java +++ b/src/net/java/games/jogl/impl/tesselator/Sweep.java @@ -404,7 +404,7 @@ class Sweep { coords[1] = isect.coords[1]; coords[2] = isect.coords[2]; - double[][] outData = new double[1][]; + Object[] outData = new Object[1]; tess.callCombineOrCombineData(coords, data, weights, outData); isect.data = outData[0]; if (isect.data == null) { diff --git a/src/net/java/games/jogl/impl/x11/X11OnscreenGLContext.java b/src/net/java/games/jogl/impl/x11/X11OnscreenGLContext.java index 1b5f54979..241a45dc9 100644 --- a/src/net/java/games/jogl/impl/x11/X11OnscreenGLContext.java +++ b/src/net/java/games/jogl/impl/x11/X11OnscreenGLContext.java @@ -103,6 +103,13 @@ public class X11OnscreenGLContext extends X11GLContext { throw new GLException("Should not call this"); } + public void setSwapInterval(int interval) { + GL gl = getGL(); + if (gl.isExtensionAvailable("GLX_SGI_swap_control")) { + gl.glXSwapIntervalSGI(interval); + } + } + protected synchronized boolean makeCurrent(Runnable initAction) throws GLException { try { if (!lockSurface()) { |