diff options
author | unknown <[email protected]> | 2014-10-02 16:15:02 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-10-08 22:12:08 +0200 |
commit | f509dcb4a60584db7b7af492f91db8c767b77eb0 (patch) | |
tree | 4314ab3f273ba6bf4146dfabf7b50b24a0afeabc /src/jogl/classes/jogamp/opengl | |
parent | 993a453fb9159c6c681882b07e318b690123988a (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')
3 files changed, 49 insertions, 8 deletions
diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java index 5d925fe03..775e2936c 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java @@ -123,7 +123,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { final WGLExt wglExt = ((WindowsWGLContext)sharedResource.getContext()).getWGLExt(); if (DEBUG) { - System.out.println(getThreadName()+": Pbuffer config: " + config); + System.err.println(getThreadName()+": Pbuffer config: " + config); } final int winattrPbuffer = GLGraphicsConfigurationUtil.getExclusiveWinAttributeBits(false /* onscreen */, false /* fbo */, true /* pbuffer */, false /* bitmap */); @@ -138,8 +138,8 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { final AbstractGraphicsDevice device = config.getScreen().getDevice(); if (DEBUG) { - System.out.println(getThreadName()+": Pbuffer parentHdc = " + toHexString(sharedHdc)); - System.out.println(getThreadName()+": Pbuffer chosenCaps: " + chosenCaps); + System.err.println(getThreadName()+": Pbuffer parentHdc = " + toHexString(sharedHdc)); + System.err.println(getThreadName()+": Pbuffer chosenCaps: " + chosenCaps); } if( !WindowsWGLGraphicsConfiguration.GLCapabilities2AttribList( sharedResource, chosenCaps, @@ -162,7 +162,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { if (DEBUG) { System.err.println("" + nformats + " suitable pixel formats found"); for (int i = 0; i < nformats; i++) { - final WGLGLCapabilities dbgCaps = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilities(sharedResource, device, glProfile, + final WGLGLCapabilities dbgCaps = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilitiesNoCheck(sharedResource, device, glProfile, sharedHdc, pformats.get(i), winattrPbuffer); System.err.println("pixel format " + pformats.get(i) + " (index " + i + "): " + dbgCaps); } 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 diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java index ea92b38fd..03d14f758 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java @@ -521,9 +521,13 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat if( 0 <= chosenIdx ) { if( _skipCapsChooser ) { final WGLGLCapabilities caps = WindowsWGLGraphicsConfiguration.PFD2GLCapabilities(device, glProfile, hdc, chosenPFDID, winattrmask); - availableCaps.add(caps); - recommendedIndex = 0; - skipCapsChooser = true; + if(null != caps) { + availableCaps.add(caps); + recommendedIndex = 0; + skipCapsChooser = true; + } else { + skipCapsChooser = false; + } } else { skipCapsChooser = false; } |