From 01975af12221798e09a72783fadd3cd0d5e1f5bc Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Sat, 7 Apr 2007 21:54:53 +0000 Subject: Fixed problem pointed out by user operator on JOGL forum where chosen GLCapabilities on Windows was returning null for pixel formats using full-scene antialiasing git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@1193 232f8b59-042b-4e1e-8c03-345bb8c30851 --- .../com/sun/opengl/impl/windows/WindowsGLDrawable.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/classes/com/sun/opengl/impl/windows/WindowsGLDrawable.java b/src/classes/com/sun/opengl/impl/windows/WindowsGLDrawable.java index 1efc1c759..d930e4dd8 100644 --- a/src/classes/com/sun/opengl/impl/windows/WindowsGLDrawable.java +++ b/src/classes/com/sun/opengl/impl/windows/WindowsGLDrawable.java @@ -77,6 +77,7 @@ public abstract class WindowsGLDrawable extends GLDrawableImpl { protected void choosePixelFormat(boolean onscreen) { PIXELFORMATDESCRIPTOR pfd = null; int pixelFormat = 0; + GLCapabilities chosenCaps = null; if (onscreen) { if ((pixelFormat = WGL.GetPixelFormat(hdc)) != 0) { // The Java2D/OpenGL pipeline probably already set a pixel @@ -256,6 +257,11 @@ public abstract class WindowsGLDrawable extends GLDrawableImpl { } } + // NOTE: officially, should make a copy of all of these + // GLCapabilities to avoid mutation by the end user during the + // chooseCapabilities call, but for the time being, assume they + // won't be changed + // Supply information to chooser pixelFormat = chooser.chooseCapabilities(capabilities, availableCaps, recommendedPixelFormat); if ((pixelFormat < 0) || (pixelFormat >= numFormats)) { @@ -267,6 +273,7 @@ public abstract class WindowsGLDrawable extends GLDrawableImpl { System.err.println(getThreadName() + ": Chosen pixel format (" + pixelFormat + "):"); System.err.println(availableCaps[pixelFormat]); } + 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()); @@ -287,7 +294,15 @@ public abstract class WindowsGLDrawable extends GLDrawableImpl { } throw new GLException("Unable to set pixel format " + pixelFormat + " for device context " + toHexString(hdc) + ": error code " + lastError); } - setChosenGLCapabilities(pfd2GLCapabilities(pfd)); + // Reuse the previously-constructed GLCapabilities because it + // turns out that using DescribePixelFormat on some pixel formats + // (which, for example, support full-scene antialiasing) for some + // reason return that they are not OpenGL-capable + if (chosenCaps != null) { + setChosenGLCapabilities(chosenCaps); + } else { + setChosenGLCapabilities(pfd2GLCapabilities(pfd)); + } pixelFormatChosen = true; } -- cgit v1.2.3