diff options
author | Sven Gothel <[email protected]> | 2012-10-04 16:47:22 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-10-04 16:47:22 +0200 |
commit | a44c2df78f708b315ab68dbee2c68448e2cc6e7e (patch) | |
tree | 6b216c5bf3ddcd2cec5bbf238894b0d10ca1513f | |
parent | 7278244e321dd1d533223e9b6d668a6acd82bc76 (diff) |
OSX Context: Fix caps determination for on-/offscreen since pformat's NSOpenGLPFAPixelBuffer is ambiguous
-rw-r--r-- | src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java index eae365925..46c8252b6 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java @@ -503,12 +503,14 @@ public abstract class MacOSXCGLContext extends GLContextImpl return 0; } GLCapabilities fixedCaps = MacOSXCGLGraphicsConfiguration.NSPixelFormat2GLCapabilities(chosenCaps.getGLProfile(), pixelFormat); - if(chosenCaps.isOnscreen() || !fixedCaps.isPBuffer()) { - // not handled, so copy them - fixedCaps.setFBO(chosenCaps.isFBO()); - fixedCaps.setPBuffer(chosenCaps.isPBuffer()); - fixedCaps.setBitmap(chosenCaps.isBitmap()); - fixedCaps.setOnscreen(chosenCaps.isOnscreen()); + if( !fixedCaps.isPBuffer() && isPBuffer ) { + throw new InternalError("handle is PBuffer, fixedCaps not: "+drawable); + } + { // determine on-/offscreen caps, since pformat is ambiguous + fixedCaps.setFBO( isFBO ); // exclusive + fixedCaps.setPBuffer( isPBuffer ); // exclusive + fixedCaps.setBitmap( false ); // n/a in our OSX impl. + fixedCaps.setOnscreen( !isFBO && !isPBuffer ); } fixedCaps = GLGraphicsConfigurationUtil.fixOpaqueGLCapabilities(fixedCaps, chosenCaps.isBackgroundOpaque()); int sRefreshRate = OSXUtil.GetScreenRefreshRate(drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getIndex()); @@ -528,15 +530,6 @@ public abstract class MacOSXCGLContext extends GLContextImpl System.err.println("NS create screen refresh-rate: "+sRefreshRate+" hz, "+screenVSyncTimeout+" micros"); // Thread.dumpStack(); } - if(fixedCaps.isPBuffer()) { - if(!isPBuffer) { - throw new InternalError("fixedCaps is PBuffer, handle not: "+drawable); - } - } else { - if(isPBuffer) { - throw new InternalError("handle is PBuffer, fixedCaps not: "+drawable); - } - } config.setChosenCapabilities(fixedCaps); /** if(null != backingLayerHost) { @@ -817,13 +810,12 @@ public abstract class MacOSXCGLContext extends GLContextImpl if (0 != ctx) { GLCapabilities fixedCaps = MacOSXCGLGraphicsConfiguration.CGLPixelFormat2GLCapabilities(pixelFormat); fixedCaps = GLGraphicsConfigurationUtil.fixOpaqueGLCapabilities(fixedCaps, chosenCaps.isBackgroundOpaque()); - if(chosenCaps.isOnscreen() || !fixedCaps.isPBuffer()) { - // not handled, so copy them - fixedCaps.setFBO(chosenCaps.isFBO()); - fixedCaps.setPBuffer(chosenCaps.isPBuffer()); - fixedCaps.setBitmap(chosenCaps.isBitmap()); - fixedCaps.setOnscreen(chosenCaps.isOnscreen()); - } + { // determine on-/offscreen caps, since pformat is ambiguous + fixedCaps.setFBO( false ); // n/a for CGLImpl + fixedCaps.setPBuffer( fixedCaps.isPBuffer() && !chosenCaps.isOnscreen() ); + fixedCaps.setBitmap( false ); // n/a in our OSX impl. + fixedCaps.setOnscreen( !fixedCaps.isPBuffer() ); + } config.setChosenCapabilities(fixedCaps); if(DEBUG) { System.err.println("CGL create fixedCaps: "+fixedCaps); |