summaryrefslogtreecommitdiffstats
path: root/src/classes/com/sun/opengl/impl
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2007-04-07 21:54:53 +0000
committerKenneth Russel <[email protected]>2007-04-07 21:54:53 +0000
commit01975af12221798e09a72783fadd3cd0d5e1f5bc (patch)
tree591ad2a5d6b88b8606498a7a8c1569e8cc8b1ecc /src/classes/com/sun/opengl/impl
parentd88b1ce92dd379aa8badb5506ab917a09f5c7c74 (diff)
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
Diffstat (limited to 'src/classes/com/sun/opengl/impl')
-rw-r--r--src/classes/com/sun/opengl/impl/windows/WindowsGLDrawable.java17
1 files changed, 16 insertions, 1 deletions
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;
}