From bf75331124d6d0c53b74d5235ec03f5fcbc55cba Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 11 Feb 2011 08:09:53 +0100 Subject: Win,GDI,SWT: Fix pfd to caps conversion. Added thorough debug code. Debug code added for use case: WinXP-32bit, GDI, SWT, where WGL.wglGetCurrentDC() returns a non null value which is invalid. Using the value (hdc) on eg GDI.GetObjectType(hdc) return 0 instead of 3 (OBJ_DC) and GDI.GetPixelFormat(hdc) returns 0 with last error 2000. --- .../opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java') diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java index 82d170133..a80f68377 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java @@ -83,7 +83,7 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio static WindowsWGLGraphicsConfiguration createFromCurrent(GLDrawableFactory _factory, long hdc, int pfdID, - GLProfile glp, AbstractGraphicsScreen screen, boolean onscreen, boolean usePBuffer) + GLProfile glp, AbstractGraphicsScreen screen, boolean onscreen) { if(_factory==null) { throw new GLException("Null factory"); @@ -105,12 +105,13 @@ public class WindowsWGLGraphicsConfiguration extends DefaultGraphicsConfiguratio WGLGLCapabilities caps = null; if(hasARB) { - caps = wglARBPFID2GLCapabilities(sharedContext, hdc, pfdID, glp, onscreen, usePBuffer); - } else if(!usePBuffer) { + caps = wglARBPFID2GLCapabilities(sharedContext, hdc, pfdID, glp, onscreen, true /* pbuffer */); + } else { caps = PFD2GLCapabilities(glp, hdc, pfdID, onscreen); } if(null==caps) { - throw new GLException("Couldn't choose Capabilities by: HDC 0x"+Long.toHexString(hdc)+", pfdID "+pfdID+", hasARB "+hasARB); + throw new GLException("Couldn't choose Capabilities by: HDC 0x"+Long.toHexString(hdc)+ + ", pfdID "+pfdID+", onscreen "+onscreen+", hasARB "+hasARB); } return new WindowsWGLGraphicsConfiguration(screen, caps, caps); -- cgit v1.2.3