aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
diff options
context:
space:
mode:
authorunknown <[email protected]>2014-10-02 16:15:02 +0200
committerunknown <[email protected]>2014-10-02 16:15:02 +0200
commit4b044d4de5272d45ec9b0b7b12ed40fa806d36e1 (patch)
treee9c0f6b3c01eb056329bd111abd7b87627e6bc89 /src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
parent1b5c2dbc9204a85eb63cea952b289f5012690f35 (diff)
Uses System.err instead of System.out in order to drive the debug logs more consistent, adds a method to convert an attribute list into a capabilities object with no check in order to display some information about skipped capabilities objects and fixes a NullPointerException when skipping a capabilities object
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java')
-rw-r--r--src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java39
1 files changed, 38 insertions, 1 deletions
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
index 24d44b5dd..5c5441c07 100644
--- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java
@@ -321,6 +321,25 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
}
return AttribList2GLCapabilities(device, glp, hdc, pfdID, iattributes, niattribs, iresults, winattrbits);
}
+
+ static WGLGLCapabilities wglARBPFID2GLCapabilitiesNoCheck(final WindowsWGLDrawableFactory.SharedResource sharedResource,
+ final AbstractGraphicsDevice device, final GLProfile glp, final long hdc, final int pfdID,
+ final int winattrbits) {
+ if (!sharedResource.hasARBPixelFormat()) {
+ return null;
+ }
+
+ final IntBuffer iattributes = Buffers.newDirectIntBuffer(2 * MAX_ATTRIBS);
+ final IntBuffer iresults = Buffers.newDirectIntBuffer(2 * MAX_ATTRIBS);
+ final int niattribs = fillAttribsForGeneralWGLARBQuery(sharedResource, iattributes);
+
+ if (!((WindowsWGLContext) sharedResource.getContext()).getWGLExt().wglGetPixelFormatAttribivARB(hdc, pfdID, 0,
+ niattribs, iattributes, iresults)) {
+ throw new GLException("wglARBPFID2GLCapabilities: Error getting pixel format attributes for pixel format "
+ + pfdID + " of device context " + toHexString(hdc) + ", werr " + GDI.GetLastError());
+ }
+ return AttribList2GLCapabilitiesNoCheck(device, glp, hdc, pfdID, iattributes, niattribs, iresults, winattrbits);
+ }
static int[] wglChoosePixelFormatARB(final WindowsWGLDrawableFactory.SharedResource sharedResource, final AbstractGraphicsDevice device,
final GLCapabilitiesImmutable capabilities,
@@ -396,7 +415,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
break;
}
} else if(DEBUG) {
- final GLCapabilitiesImmutable skipped = AttribList2GLCapabilities(device, glp, hdc, pfdIDs[i], iattributes, niattribs, iresults, GLGraphicsConfigurationUtil.ALL_BITS);
+ final GLCapabilitiesImmutable skipped = AttribList2GLCapabilitiesNoCheck(device, glp, hdc, pfdIDs[i], iattributes, niattribs, iresults, GLGraphicsConfigurationUtil.ALL_BITS);
System.err.println("wglARBPFIDs2GLCapabilities: bucket["+i+" -> skip]: pfdID "+pfdIDs[i]+", "+skipped+", winattr "+GLGraphicsConfigurationUtil.winAttributeBits2String(null, winattrbits).toString());
}
} else if (DEBUG) {
@@ -564,6 +583,24 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio
res.setValuesByARB(iattribs, niattribs, iresults);
return (WGLGLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res);
}
+
+ static WGLGLCapabilities AttribList2GLCapabilitiesNoCheck(final AbstractGraphicsDevice device, final GLProfile glp,
+ final long hdc, final int pfdID, final IntBuffer iattribs, final int niattribs, final IntBuffer iresults,
+ final int winattrmask) {
+ final int allDrawableTypeBits = AttribList2DrawableTypeBits(iattribs, niattribs, iresults);
+ int drawableTypeBits = winattrmask & allDrawableTypeBits;
+
+ if (0 == drawableTypeBits) {
+ return null;
+ }
+ final PIXELFORMATDESCRIPTOR pfd = createPixelFormatDescriptor();
+
+ WGLUtil.DescribePixelFormat(hdc, pfdID, PIXELFORMATDESCRIPTOR.size(), pfd);
+ final WGLGLCapabilities res = new WGLGLCapabilities(pfd, pfdID, glp);
+ res.setValuesByARB(iattribs, niattribs, iresults);
+ return (WGLGLCapabilities) GLGraphicsConfigurationUtil
+ .fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res);
+ }
//
// GDI PIXELFORMAT