From bff7e97c2f22673bb0457765696fb867d3e4f69d Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 11 Feb 2011 17:28:06 +0100 Subject: Win,ARB,GL-2.x: Fix pfd to caps conversion: !pbuffer / Cleanup This fix enables the configuration win7 64bit chromium2.1 (virtual box 4.0.2 linux host) Querying unsupported pixel format attributes, ie pbuffer, will fail the ARB attribute query functions. Cleanup of SharedResource's, hold all reused flags in win32 impl, ie pbuffer, arb pixelformat, .. --- .../opengl/windows/wgl/WindowsPbufferWGLDrawable.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java') diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java index 7be630187..83354a7fb 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java @@ -59,16 +59,15 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { private int floatMode; - public WindowsPbufferWGLDrawable(GLDrawableFactory factory, NativeSurface target, - WindowsWGLDrawable dummyDrawable, - WindowsWGLContext sharedCtx) { + protected WindowsPbufferWGLDrawable(GLDrawableFactory factory, NativeSurface target, + WindowsWGLDrawableFactory.SharedResource sharedResource) { super(factory, target, true); if (DEBUG) { System.out.println("Pbuffer config: " + getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration()); } - createPbuffer(dummyDrawable.getNativeSurface().getSurfaceHandle(), sharedCtx); + createPbuffer(sharedResource); if (DEBUG) { System.err.println("Created pbuffer " + this); @@ -125,13 +124,15 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { } } - private void createPbuffer(long parentHdc, WindowsWGLContext sharedCtx) { + private void createPbuffer(WindowsWGLDrawableFactory.SharedResource sharedResource) { + long parentHdc = sharedResource.getDrawable().getNativeSurface().getSurfaceHandle(); + WGLExt wglExt = sharedResource.getContext().getWGLExt(); + int[] iattributes = new int [2*WindowsWGLGraphicsConfiguration.MAX_ATTRIBS]; float[] fattributes = new float[1]; int[] floatModeTmp = new int[1]; int niattribs = 0; int width, height; - WGLExt wglExt = sharedCtx.getWGLExt(); WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration) getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration(); GLCapabilitiesImmutable chosenCaps = (GLCapabilitiesImmutable)config.getChosenCapabilities(); @@ -143,7 +144,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { } if(!WindowsWGLGraphicsConfiguration.GLCapabilities2AttribList(chosenCaps, - iattributes, sharedCtx, -1, floatModeTmp)){ + iattributes, sharedResource, -1, floatModeTmp)){ throw new GLException("Pbuffer-related extensions not supported"); } @@ -176,7 +177,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { if (DEBUG) { System.err.println("" + nformats + " suitable pixel formats found"); for (int i = 0; i < nformats; i++) { - WGLGLCapabilities dbgCaps = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilities(sharedCtx, parentHdc, pformats[i], glProfile, false, true); + WGLGLCapabilities dbgCaps = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilities(sharedResource, parentHdc, pformats[i], glProfile, false, true); System.err.println("pixel format " + pformats[i] + " (index " + i + "): " + dbgCaps); } } @@ -240,7 +241,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { // Re-query chosen pixel format { - WGLGLCapabilities newCaps = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilities(sharedCtx, parentHdc, pfdid, glProfile, false, true); + WGLGLCapabilities newCaps = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilities(sharedResource, parentHdc, pfdid, glProfile, false, true); if(null == newCaps) { throw new GLException("pbuffer creation error: unable to re-query chosen PFD ID: " + pfdid + ", hdc " + this.toHexString(tmpHdc)); } -- cgit v1.2.3