aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/sun
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2009-06-12 12:34:29 +0000
committerSven Gothel <[email protected]>2009-06-12 12:34:29 +0000
commit2bcbaedd3be76960f6cdce40bd650ce58f9078c5 (patch)
tree96898d35cff16fe69b692cb1f758e0343a6a5a48 /src/jogl/classes/com/sun
parentbae43fc88273ed7b07884a7f0f627f560a03be54 (diff)
- Adding CR + TAB to toString() methods for better visibility,
use a unix style capable viewer/editor for the debug methods .. - Multihead code is working now for - GLCanvas, GLJPanel - Newt: GLWindow, AWTWindow and WindowsWindow WindowsWindow is using the MonitorFromWindow(HWND) win32 method to detect a monitor change, same as AWT's implementation. AWT does the detection within getGraphicsConfiguration(). Added documention in GLAutoDrawable inkl. the fixed protocol for such a case (regeneration cycle). The interesting thing here is, that in my test environment, the windows NV driver keeps up the previous HDC pixelformat even within a new HDC (all same HWND), if the HWND is dragged from a 32bpp-screen to a 16bpp-screen and vice versa. But for the sake of other driver behaviors, this implementation shall fix the multihead support on windows and other non Xinerama driven arrangements. Another good thing of the in deep investigation was to fix the documentation and other bus, as follows: - FIX GLDrawableHelper.dispose(): Don't remove the event listeners, since dispose() does not mean EOL. - FIX remove all actions of NativeWindow.LOCK_SURFACE_CHANGED, due to the unreliable (never worked here for me) behavior. Also .. acting on a surface change from within a GLDrawable is already to low level, and misses all the appropriate actions. See GLAutoDrawable for the spec. - FIX all GLDrawable implementations update the graphics configuration on setVisible(true), except MacOSX, which does it on create context. The latter is ok with the spec .. - FIX removed the windows NO_FREE hack, since it could introduce a non released context .. which is not good. The context state shall be completely handled by GLContext - FIX GLDrawableImpl.setVisible(false): removed nativewindow invalidate() call - this is wrong, due to the spec. A window may survive many cycles of setVisible(). - FIX GLCOntextImpl lock the lock as soon as possible in destroy() - Add native method WindowsWindow.MonitorFromWindow(..) git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1932 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/jogl/classes/com/sun')
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java3
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java53
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/GLDrawableHelper.java5
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java10
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java31
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java6
-rwxr-xr-xsrc/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenContext.java3
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java3
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsOnscreenWGLContext.java6
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java17
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawable.java3
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java5
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java27
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java4
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java38
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java5
-rw-r--r--src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXContext.java3
17 files changed, 95 insertions, 127 deletions
diff --git a/src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java b/src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java
index 23ce26154..63dba3ff0 100644
--- a/src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java
+++ b/src/jogl/classes/com/sun/opengl/impl/ExtensionAvailabilityCache.java
@@ -52,6 +52,7 @@ import java.lang.reflect.*;
*/
public final class ExtensionAvailabilityCache {
private static final boolean DEBUG = Debug.debug("ExtensionAvailabilityCache");
+ private static final boolean DEBUG_AVAILABILITY = Debug.isPropertyDefined("ExtensionAvailabilityCache");
ExtensionAvailabilityCache(GLContextImpl context)
{
@@ -91,7 +92,7 @@ public final class ExtensionAvailabilityCache {
String availableExt = tok.nextToken().trim();
availableExt = availableExt.intern();
availableExtensionCache.add(availableExt);
- if (DEBUG) {
+ if (DEBUG_AVAILABILITY) {
System.err.println("!!! Available: " + availableExt);
}
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java b/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java
index 48a58b962..da0d96396 100644
--- a/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java
+++ b/src/jogl/classes/com/sun/opengl/impl/GLContextImpl.java
@@ -51,7 +51,6 @@ public abstract class GLContextImpl extends GLContext {
protected GLContextLock lock = new GLContextLock();
protected static final boolean DEBUG = Debug.debug("GLContext");
protected static final boolean VERBOSE = Debug.verbose();
- protected static final boolean NO_FREE = Debug.isPropertyDefined("jogl.GLContext.nofree");
// NOTE: default sense of GLContext optimization disabled in JSR-231
// 1.0 beta 5 due to problems on X11 platforms (both Linux and
// Solaris) when moving and resizing windows. Apparently GLX tokens
@@ -175,36 +174,36 @@ public abstract class GLContextImpl extends GLContext {
release();
}
- /* FIXME: refactor dependence on Java 2D / JOGL bridge
- if (tracker != null) {
- // Don't need to do anything for contexts that haven't been
- // created yet
- if (isCreated()) {
- // If we are tracking creation and destruction of server-side
- // OpenGL objects, we must decrement the reference count of the
- // GLObjectTracker upon context destruction.
- //
- // Note that we can only eagerly delete these server-side
- // objects if there is another context currrent right now
- // which shares textures and display lists with this one.
- tracker.unref(deletedObjectTracker);
- }
- }
- */
-
- // Because we don't know how many other contexts we might be
- // sharing with (and it seems too complicated to implement the
- // GLObjectTracker's ref/unref scheme for the buffer-related
- // optimizations), simply clear the cache of known buffers' sizes
- // when we destroy contexts
- if (bufferSizeTracker != null) {
- bufferSizeTracker.clearCachedBufferSizes();
- }
-
// Must hold the lock around the destroy operation to make sure we
// don't destroy the context out from under another thread rendering to it
lock.lock();
try {
+ /* FIXME: refactor dependence on Java 2D / JOGL bridge
+ if (tracker != null) {
+ // Don't need to do anything for contexts that haven't been
+ // created yet
+ if (isCreated()) {
+ // If we are tracking creation and destruction of server-side
+ // OpenGL objects, we must decrement the reference count of the
+ // GLObjectTracker upon context destruction.
+ //
+ // Note that we can only eagerly delete these server-side
+ // objects if there is another context currrent right now
+ // which shares textures and display lists with this one.
+ tracker.unref(deletedObjectTracker);
+ }
+ }
+ */
+
+ // Because we don't know how many other contexts we might be
+ // sharing with (and it seems too complicated to implement the
+ // GLObjectTracker's ref/unref scheme for the buffer-related
+ // optimizations), simply clear the cache of known buffers' sizes
+ // when we destroy contexts
+ if (bufferSizeTracker != null) {
+ bufferSizeTracker.clearCachedBufferSizes();
+ }
+
destroyImpl();
} finally {
lock.unlock();
diff --git a/src/jogl/classes/com/sun/opengl/impl/GLDrawableHelper.java b/src/jogl/classes/com/sun/opengl/impl/GLDrawableHelper.java
index 3ede86196..95c868d00 100644
--- a/src/jogl/classes/com/sun/opengl/impl/GLDrawableHelper.java
+++ b/src/jogl/classes/com/sun/opengl/impl/GLDrawableHelper.java
@@ -78,12 +78,9 @@ public class GLDrawableHelper {
}
public synchronized void dispose(GLAutoDrawable drawable) {
- List newListeners = (List) ((ArrayList) listeners).clone();
- for (Iterator iter = newListeners.iterator(); iter.hasNext(); ) {
+ for (Iterator iter = listeners.iterator(); iter.hasNext(); ) {
((GLEventListener) iter.next()).dispose(drawable);
- iter.remove();
}
- listeners = newListeners;
}
public void init(GLAutoDrawable drawable) {
diff --git a/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java b/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java
index c470d7d4d..c381f68f5 100644
--- a/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java
+++ b/src/jogl/classes/com/sun/opengl/impl/GLDrawableImpl.java
@@ -99,9 +99,6 @@ public abstract class GLDrawableImpl implements GLDrawable {
public void setRealized(boolean realized) {
this.realized = realized;
- if(!realized) {
- component.invalidate();
- }
}
public boolean getRealized() {
@@ -134,9 +131,10 @@ public abstract class GLDrawableImpl implements GLDrawable {
public String toString() {
return getClass().getName()+"[realized "+getRealized()+
- ", capabilities "+getChosenGLCapabilities()+
- ", window "+getNativeWindow()+
- ", factory "+getFactory()+"]";
+ ",\n\trequested "+getRequestedGLCapabilities()+
+ ",\n\tchosen "+getChosenGLCapabilities()+
+ ",\n\twindow "+getNativeWindow()+
+ ",\n\tfactory "+getFactory()+"]";
}
protected GLDrawableFactory factory;
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java
index a07030eb1..4dd191263 100755
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java
+++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLDrawable.java
@@ -82,33 +82,12 @@ public abstract class EGLDrawable extends GLDrawableImpl {
EGL.eglDestroySurface(eglDisplay, eglSurface);
}
eglSurface = createSurface(eglDisplay, eglConfig.getNativeConfig());
- }
- public int lockSurface() throws GLException {
- int ret = super.lockSurface();
- if(NativeWindow.LOCK_SURFACE_NOT_READY == ret) {
- if (DEBUG) {
- System.err.println("EGLDrawable.lockSurface: surface not ready");
- }
- return ret;
+ if(DEBUG) {
+ System.err.println("setSurface using component: handle 0x"+Long.toHexString(component.getWindowHandle())+" -> 0x"+Long.toHexString(eglSurface));
}
- if (NativeWindow.LOCK_SURFACE_CHANGED == ret) {
- AbstractGraphicsConfiguration aConfig = component.getGraphicsConfiguration().getNativeGraphicsConfiguration();
- // ensure this is a EGLGraphicsConfiguration, ie setRealized(true) already validated the EGL config and eglSurface.
- if(EGL.EGL_NO_SURFACE!=eglSurface && aConfig instanceof EGLGraphicsConfiguration) {
- if(DEBUG) {
- System.err.println("NativeWindow.LOCK_SURFACE_CHANGED: "+component);
- }
- ((EGLGraphicsConfiguration)aConfig).updateGraphicsConfiguration();
- recreateSurface();
- } else {
- ret = NativeWindow.LOCK_SUCCESS; // overwrite result, no surface change action required yet
- }
- }
- return ret;
}
-
public void setRealized(boolean realized) {
super.setRealized(realized);
@@ -131,6 +110,7 @@ public abstract class EGLDrawable extends GLDrawableImpl {
if (null == eglConfig) {
throw new GLException("Null EGLGraphicsConfiguration from "+aConfig);
}
+ eglConfig.updateGraphicsConfiguration();
} else {
throw new GLException("EGLGraphicsConfiguration doesn't carry a EGLGraphicsDevice: "+aConfig);
}
@@ -169,10 +149,7 @@ public abstract class EGLDrawable extends GLDrawableImpl {
System.err.println("Chosen eglConfig: "+eglConfig);
}
}
- eglSurface = createSurface(eglDisplay, eglConfig.getNativeConfig());
- if(DEBUG) {
- System.err.println("setSurface using component: handle 0x"+Long.toHexString(component.getWindowHandle())+" -> 0x"+Long.toHexString(eglSurface));
- }
+ recreateSurface();
} finally {
unlockSurface();
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java
index 43f6b2de2..4f04bb57a 100644
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java
+++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLGraphicsConfiguration.java
@@ -246,7 +246,11 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple
}
public String toString() {
- return getClass().toString()+"["+getScreen()+", eglConfigID "+configID+ ", "+getChosenCapabilities()+"]";
+ return getClass().toString()+"["+getScreen()+", eglConfigID "+configID+
+ ",\n\trequested " + getRequestedCapabilities()+
+ ",\n\tchosen " + getChosenCapabilities()+
+ "]";
+
}
private GLCapabilitiesChooser chooser;
diff --git a/src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenContext.java b/src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenContext.java
index ee706b50f..e2085b228 100755
--- a/src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenContext.java
+++ b/src/jogl/classes/com/sun/opengl/impl/egl/EGLOnscreenContext.java
@@ -54,9 +54,6 @@ public class EGLOnscreenContext extends EGLContext {
if (lockRes == NativeWindow.LOCK_SURFACE_NOT_READY) {
return CONTEXT_NOT_CURRENT;
}
- if (lockRes == NativeWindow.LOCK_SURFACE_CHANGED) {
- destroyImpl();
- }
return super.makeCurrentImpl();
} catch (RuntimeException e) {
exceptionOccurred = true;
diff --git a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java
index 19ee5b94b..f87cc150b 100644
--- a/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java
+++ b/src/jogl/classes/com/sun/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java
@@ -61,9 +61,6 @@ public class MacOSXOnscreenCGLContext extends MacOSXCGLContext {
if (lockRes == NativeWindow.LOCK_SURFACE_NOT_READY) {
return CONTEXT_NOT_CURRENT;
}
- if (lockRes == NativeWindow.LOCK_SURFACE_CHANGED) {
- destroyImpl();
- }
int ret = super.makeCurrentImpl();
if ((ret == CONTEXT_CURRENT) ||
(ret == CONTEXT_CURRENT_NEW)) {
diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsOnscreenWGLContext.java b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsOnscreenWGLContext.java
index 4ab34d0e2..f6eba0ab1 100644
--- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsOnscreenWGLContext.java
+++ b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsOnscreenWGLContext.java
@@ -61,12 +61,6 @@ public class WindowsOnscreenWGLContext extends WindowsWGLContext {
if (lockRes == NativeWindow.LOCK_SURFACE_NOT_READY) {
return CONTEXT_NOT_CURRENT;
}
- if (lockRes == NativeWindow.LOCK_SURFACE_CHANGED) {
- if (DEBUG) {
- System.err.println("!!! SURFACE_CHANGED WindowsOnscreenWGLContext.makeCurrentImpl: NEW CONTEXT");
- }
- destroyImpl();
- }
int ret = super.makeCurrentImpl();
return ret;
} catch (RuntimeException e) {
diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java
index 13ee50773..1bc3acada 100644
--- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java
+++ b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLContext.java
@@ -127,9 +127,6 @@ public class WindowsWGLContext extends GLContextImpl {
if (drawable.getNativeWindow().getSurfaceHandle() == 0) {
throw new GLException("Internal error: attempted to create OpenGL context without an associated drawable");
}
- if (DEBUG) {
- System.err.println(getThreadName() + ": !!! Created OpenGL context " + toHexString(hglrc) + " for " + this + ", device context " + toHexString(drawable.getNativeWindow().getSurfaceHandle()) + ", not yet sharing");
- }
// Windows can set up sharing of display lists after creation time
WindowsWGLContext other = (WindowsWGLContext) GLContextShareSet.getShareContext(this);
long hglrc2 = 0;
@@ -143,6 +140,9 @@ public class WindowsWGLContext extends GLContextImpl {
// To use WGL_ARB_create_context, we have to make a temp context current,
// so we are able to use GetProcAddress
long temp_hglrc = WGL.wglCreateContext(drawable.getNativeWindow().getSurfaceHandle());
+ if (DEBUG) {
+ System.err.println(getThreadName() + ": !!! Created temp OpenGL context " + toHexString(temp_hglrc) + " for " + this + ", device context " + toHexString(drawable.getNativeWindow().getSurfaceHandle()) + ", not yet sharing");
+ }
if (temp_hglrc == 0) {
throw new GLException("Unable to create temp OpenGL context for device context " + toHexString(drawable.getNativeWindow().getSurfaceHandle()));
} else {
@@ -270,21 +270,20 @@ public class WindowsWGLContext extends GLContextImpl {
}
protected void releaseImpl() throws GLException {
- if (!NO_FREE) {
- if (!WGL.wglMakeCurrent(0, 0)) {
+ if (!WGL.wglMakeCurrent(0, 0)) {
throw new GLException("Error freeing OpenGL context: " + WGL.GetLastError());
- }
}
}
protected void destroyImpl() throws GLException {
+ if (DEBUG) {
+ Exception e = new Exception(getThreadName() + ": !!! Destroyed OpenGL context " + toHexString(hglrc));
+ e.printStackTrace();
+ }
if (hglrc != 0) {
if (!WGL.wglDeleteContext(hglrc)) {
throw new GLException("Unable to delete OpenGL context");
}
- if (DEBUG) {
- System.err.println(getThreadName() + ": !!! Destroyed OpenGL context " + toHexString(hglrc));
- }
hglrc = 0;
GLContextShareSet.contextDestroyed(this);
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawable.java b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawable.java
index 3915c7af0..464cfbcc2 100644
--- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawable.java
+++ b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLDrawable.java
@@ -58,8 +58,7 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl {
return; // nothing todo ..
}
- int ret = lockSurface();
- if(NativeWindow.LOCK_SURFACE_NOT_READY == ret) {
+ if(NativeWindow.LOCK_SURFACE_NOT_READY == lockSurface()) {
throw new GLException("WindowsWGLDrawable.setRealized(true): lockSurface - surface not ready");
}
try {
diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java
index 54080fa3d..8b721824e 100644
--- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java
+++ b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfiguration.java
@@ -434,7 +434,10 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio
}
public String toString() {
- return "WindowsWGLGraphicsConfiguration["+getScreen()+", pfdID " + pixelfmtID + ", " + getChosenCapabilities() +"]";
+ return "WindowsWGLGraphicsConfiguration["+getScreen()+", pfdID " + pixelfmtID +
+ ",\n\trequested " + getRequestedCapabilities() +
+ ",\n\tchosen " + getChosenCapabilities() +
+ "]";
}
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
index d508c0e12..df8081f05 100644
--- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
@@ -91,17 +91,25 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
GLProfile glProfile = capabilities.getGLProfile();
long hdc = nativeWindow.getSurfaceHandle();
+ if (DEBUG) {
+ Exception ex = new Exception("WindowsWGLGraphicsConfigurationFactory got HDC 0x"+Long.toHexString(hdc));
+ ex.printStackTrace();
+ System.err.println("WindowsWGLGraphicsConfigurationFactory got NW "+nativeWindow);
+ }
+
PIXELFORMATDESCRIPTOR pfd = null;
int pixelFormat = 0;
GLCapabilities chosenCaps = null;
if (!useOffScreen) {
if ((pixelFormat = WGL.GetPixelFormat(hdc)) != 0) {
- // The Java2D/OpenGL pipeline probably already set a pixel
- // format for this canvas.
+ // Pixelformat already set by either
+ // - a previous updateGraphicsConfiguration() call on the same HDC,
+ // - the graphics driver, copying the HDC's pixelformat to the new one,
+ // - or the Java2D/OpenGL pipeline's configuration
if (DEBUG) {
- System.err.println("NOTE: pixel format already chosen (by Java2D/OpenGL pipeline?) for window: " +
- WGL.GetPixelFormat(hdc));
+ System.err.println("!!!! NOTE: pixel format already chosen for HDC: 0x" + Long.toHexString(hdc)+
+ ", pixelformat "+WGL.GetPixelFormat(hdc));
}
pfd = WindowsWGLGraphicsConfiguration.createPixelFormatDescriptor();
if (WGL.DescribePixelFormat(hdc, pixelFormat, pfd.size(), pfd) == 0) {
@@ -257,11 +265,12 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
}
}
pfd = WindowsWGLGraphicsConfiguration.GLCapabilities2PFD(capabilities, !useOffScreen);
- // Remove one-basing of pixel format (added on later)
- recommendedPixelFormat = WGL.ChoosePixelFormat(hdc, pfd) - 1;
+ recommendedPixelFormat = WGL.ChoosePixelFormat(hdc, pfd);
if (DEBUG) {
System.err.println(getThreadName() + ": Recommended pixel format = " + recommendedPixelFormat);
}
+ // Remove one-basing of pixel format (added on later)
+ recommendedPixelFormat -= 1;
numFormats = WGL.DescribePixelFormat(hdc, 1, 0, null);
if (numFormats == 0) {
@@ -297,12 +306,12 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
" from GLCapabilitiesChooser (should be between 0 and " +
(numFormats - 1) + ")");
}
+ pixelFormat += 1; // one-base the index
+ chosenCaps = availableCaps[pixelFormat-1];
if (DEBUG) {
System.err.println(getThreadName() + ": Chosen pixel format (" + pixelFormat + "):");
- System.err.println(availableCaps[pixelFormat]);
+ System.err.println(chosenCaps);
}
- chosenCaps = availableCaps[pixelFormat];
- pixelFormat += 1; // one-base the index
if (WGL.DescribePixelFormat(hdc, pixelFormat, pfd.size(), pfd) == 0) {
throw new GLException("Error re-describing the chosen pixel format: " + WGL.GetLastError());
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java
index 7bcfd259a..4b76be6aa 100644
--- a/src/jogl/classes/com/sun/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/sun/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java
@@ -104,6 +104,10 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GraphicsConfigura
throw new GLException("Unable to choose a GraphicsConfiguration: "+capabilities+",\n\t"+chooser+"\n\t"+winScreen);
}
+ if(DEBUG) {
+ System.err.println("WindowsAWTWGLGraphicsConfigurationFactory: chosen "+winConfig);
+ }
+
// FIXME: we have nothing to match .. so choose the default
return new AWTGraphicsConfiguration(awtScreen, winConfig.getChosenCapabilities(), winConfig.getRequestedCapabilities(), gc, winConfig);
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java
index ae57a254b..693bc531f 100644
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java
+++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXDrawable.java
@@ -54,34 +54,24 @@ public abstract class X11GLXDrawable extends GLDrawableImpl {
return (X11GLXDrawableFactory) getFactoryImpl() ;
}
- public int lockSurface() throws GLException {
- int ret = super.lockSurface();
- if(NativeWindow.LOCK_SURFACE_NOT_READY == ret) {
- if (DEBUG) {
- System.err.println("X11GLXDrawable.lockSurface: surface not ready");
- }
- return ret;
- }
- if (NativeWindow.LOCK_SURFACE_CHANGED == ret) {
- X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
- config.updateGraphicsConfiguration();
- }
- return ret;
- }
-
public void setRealized(boolean realized) {
super.setRealized(realized);
- if(realized) {
- int lockRes = lockSurface();
- try {
- // nothing to do, but complied with protocol,
- // ie resolved the window/surface handles
- } finally {
- if ( lockRes != NativeWindow.LOCK_SURFACE_NOT_READY ) {
- unlockSurface();
- }
+ if(!realized) {
+ return; // nothing to do
+ }
+
+ if(NativeWindow.LOCK_SURFACE_NOT_READY == lockSurface()) {
+ throw new GLException("X11GLXDrawable.setRealized(true): lockSurface - surface not ready");
+ }
+ try {
+ X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
+ config.updateGraphicsConfiguration();
+ if (DEBUG) {
+ System.err.println("!!! X11GLXDrawable.setRealized(true): "+config);
}
+ } finally {
+ unlockSurface();
}
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java
index 84e9bfc50..404881329 100644
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java
+++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11GLXGraphicsConfiguration.java
@@ -433,7 +433,10 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem
}
public String toString() {
- return "X11GLXGraphicsConfiguration["+getScreen()+", visualID 0x" + Long.toHexString(getVisualID()) + ", fbConfigID 0x" + Long.toHexString(fbConfigID) + ", " + getChosenCapabilities() +"]";
+ return "X11GLXGraphicsConfiguration["+getScreen()+", visualID 0x" + Long.toHexString(getVisualID()) + ", fbConfigID 0x" + Long.toHexString(fbConfigID) +
+ ",\n\trequested " + getRequestedCapabilities()+
+ ",\n\tchosen " + getChosenCapabilities()+
+ "]";
}
}
diff --git a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXContext.java b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXContext.java
index 2393eda15..1fac3c09a 100644
--- a/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXContext.java
+++ b/src/jogl/classes/com/sun/opengl/impl/x11/glx/X11OnscreenGLXContext.java
@@ -64,9 +64,6 @@ public class X11OnscreenGLXContext extends X11GLXContext {
if (lockRes == NativeWindow.LOCK_SURFACE_NOT_READY) {
return CONTEXT_NOT_CURRENT;
}
- if (lockRes == NativeWindow.LOCK_SURFACE_CHANGED) {
- destroyImpl();
- }
return super.makeCurrentImpl();
} catch (RuntimeException e) {
exceptionOccurred = true;