diff options
author | Sven Gothel <[email protected]> | 2011-02-05 02:39:25 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-02-05 02:39:25 +0100 |
commit | 5d18d6b57f7d9d92a9f568e20beb64a6d44de25a (patch) | |
tree | d157eda355bdf27784efd52ac90a2a4c90640e4c | |
parent | 6dd574f75e0b27de31136c05cc0ed18f075f004f (diff) |
Fix bug #461 on NV/Win (caps selection)
Allows TestBug461OffscreenSupersamplingSwingAWT to pass on NV/Win7.
Root cause was using the requested unfixed caps (onscreen, !pbuffer)
instead of the fixed ones.
5 files changed, 28 insertions, 25 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java index 32a4f5e70..51c87b9ec 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/GLDrawableFactoryImpl.java @@ -150,8 +150,6 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { width + ", " + height + "))"); } - GLCapabilitiesImmutable capsChosen; - AbstractGraphicsDevice device = getOrCreateSharedDevice(deviceReq); if(null == device) { throw new GLException("No shared device for requested: "+deviceReq); @@ -160,17 +158,8 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { if (!canCreateGLPbuffer(device)) { throw new GLException("Pbuffer support not available with device: "+device); } - - if( capsRequested.getDoubleBuffered() || capsRequested.isOnscreen() || !capsRequested.isPBuffer()) { - // fix caps .. - GLCapabilities caps2 = (GLCapabilities) capsRequested.cloneMutable(); - caps2.setDoubleBuffered(false); // FIXME DBLBUFOFFSCRN - caps2.setPBuffer(true); - capsChosen = caps2; - } else { - capsChosen = capsRequested; - } - + + GLCapabilitiesImmutable capsChosen = GLGraphicsConfigurationUtil.fixGLPBufferGLCapabilities(capsRequested); GLDrawableImpl drawable = null; device.lock(); try { diff --git a/src/jogl/classes/com/jogamp/opengl/impl/GLGraphicsConfigurationUtil.java b/src/jogl/classes/com/jogamp/opengl/impl/GLGraphicsConfigurationUtil.java index 53d42259a..529b32f2c 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/GLGraphicsConfigurationUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/GLGraphicsConfigurationUtil.java @@ -113,6 +113,7 @@ public class GLGraphicsConfigurationUtil { } return capsRequested; } + public static GLCapabilitiesImmutable fixOffScreenGLCapabilities(GLCapabilitiesImmutable capsRequested, boolean pbufferAvailable) { if( capsRequested.getDoubleBuffered() || @@ -130,4 +131,17 @@ public class GLGraphicsConfigurationUtil { } return capsRequested; } + + public static GLCapabilitiesImmutable fixGLPBufferGLCapabilities(GLCapabilitiesImmutable capsRequested) + { + if( capsRequested.getDoubleBuffered() || capsRequested.isOnscreen() || !capsRequested.isPBuffer()) { + // fix caps .. + GLCapabilities caps2 = (GLCapabilities) capsRequested.cloneMutable(); + caps2.setDoubleBuffered(false); // FIXME DBLBUFOFFSCRN + caps2.setPBuffer(true); + return caps2; + } + return capsRequested; + } + } diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java index 720ac84ca..a8d37796e 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsPbufferWGLDrawable.java @@ -134,23 +134,23 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { WGLExt wglExt = sharedCtx.getWGLExt(); WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration) getNativeSurface().getGraphicsConfiguration().getNativeGraphicsConfiguration(); - GLCapabilitiesImmutable capabilities = (GLCapabilitiesImmutable)config.getRequestedCapabilities(); - GLProfile glProfile = capabilities.getGLProfile(); + GLCapabilitiesImmutable chosenCaps = (GLCapabilitiesImmutable)config.getChosenCapabilities(); + GLProfile glProfile = chosenCaps.getGLProfile(); if (DEBUG) { System.out.println("Pbuffer parentHdc = " + toHexString(parentHdc)); - System.out.println("Pbuffer caps: " + capabilities); + System.out.println("Pbuffer chosenCaps: " + chosenCaps); } - if(!WindowsWGLGraphicsConfiguration.GLCapabilities2AttribList(capabilities, + if(!WindowsWGLGraphicsConfiguration.GLCapabilities2AttribList(chosenCaps, iattributes, sharedCtx, -1, floatModeTmp)){ throw new GLException("Pbuffer-related extensions not supported"); } floatMode = floatModeTmp[0]; - boolean rtt = capabilities.getPbufferRenderToTexture(); - boolean rect = capabilities.getPbufferRenderToTextureRectangle(); - boolean useFloat = capabilities.getPbufferFloatingPointBuffers(); + boolean rtt = chosenCaps.getPbufferRenderToTexture(); + boolean rect = chosenCaps.getPbufferRenderToTextureRectangle(); + boolean useFloat = chosenCaps.getPbufferFloatingPointBuffers(); boolean ati = false; if (useFloat) { diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java index 674690e50..f44c3c70b 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java @@ -363,8 +363,8 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { throw new IllegalArgumentException("Null target"); } AbstractGraphicsConfiguration config = target.getGraphicsConfiguration().getNativeGraphicsConfiguration(); - GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); - if(!caps.isPBuffer()) { + GLCapabilitiesImmutable chosenCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); + if(!chosenCaps.isPBuffer()) { return new WindowsBitmapWGLDrawable(this, target); } diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXDrawable.java index 41cd543aa..65970dab2 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11PbufferGLXDrawable.java @@ -94,13 +94,13 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { NativeSurface ns = getNativeSurface(); - GLCapabilitiesImmutable capabilities = (GLCapabilitiesImmutable)config.getChosenCapabilities(); + GLCapabilitiesImmutable chosenCaps = (GLCapabilitiesImmutable)config.getChosenCapabilities(); - if (capabilities.getPbufferRenderToTexture()) { + if (chosenCaps.getPbufferRenderToTexture()) { throw new GLException("Render-to-texture pbuffers not supported yet on X11"); } - if (capabilities.getPbufferRenderToTextureRectangle()) { + if (chosenCaps.getPbufferRenderToTextureRectangle()) { throw new GLException("Render-to-texture-rectangle pbuffers not supported yet on X11"); } |