From b41b720c4366d4e2cdc1ba146123b87da966d724 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Sat, 26 Feb 2005 01:41:28 +0000 Subject: Merged with current JOGL trunk (tag JOGL_1_1_PRE_B10) git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JSR-231@245 232f8b59-042b-4e1e-8c03-345bb8c30851 --- .../jogl/impl/windows/WindowsOnscreenGLContext.java | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/net/java/games/jogl/impl/windows/WindowsOnscreenGLContext.java') diff --git a/src/net/java/games/jogl/impl/windows/WindowsOnscreenGLContext.java b/src/net/java/games/jogl/impl/windows/WindowsOnscreenGLContext.java index 3bfdee5d1..de13be0a1 100644 --- a/src/net/java/games/jogl/impl/windows/WindowsOnscreenGLContext.java +++ b/src/net/java/games/jogl/impl/windows/WindowsOnscreenGLContext.java @@ -61,6 +61,25 @@ public class WindowsOnscreenGLContext extends WindowsGLContext { super(component, capabilities, chooser, shareWith); } + public void invokeGL(Runnable runnable, boolean isReshape, Runnable initAction) throws GLException { + // Unfortunately, invokeGL can be called with the AWT tree lock + // held, and the Windows onscreen implementation of + // choosePixelFormatAndCreateContext calls + // Component.getGraphicsConfiguration(), which grabs the tree + // lock. To avoid deadlock we have to lock the tree lock before + // grabbing the GLContext's lock if we're going to create an + // OpenGL context during this call. This code might not be + // completely correct, and we might need to uniformly grab the AWT + // tree lock, which might become a performance issue... + if (hglrc == 0) { + synchronized(component.getTreeLock()) { + super.invokeGL(runnable, isReshape, initAction); + } + } else { + super.invokeGL(runnable, isReshape, initAction); + } + } + protected GL createGL() { return new WindowsGLImpl(this); @@ -83,7 +102,7 @@ public class WindowsOnscreenGLContext extends WindowsGLContext { } public boolean canCreatePbufferContext() { - return true; + return haveWGLARBPbuffer(); } public synchronized GLContext createPbufferContext(GLCapabilities capabilities, -- cgit v1.2.3