From 90d45928186f2be99999461cfe45f76a783cc961 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 7 Sep 2012 05:46:22 +0200 Subject: Fix Capabilities ambiguity and explosion of queried available-list; Add FBO availability detection for EGL, WGL and OSX. Introducing Capabilities 'bitmap' boolean, complementing the offscreen modes FBO and PBuffer. This allows: 1 - deterministic setting of the offscreen mode 2 - utilizing auto configuration of offscreen mode, if !onscreen !FBO !PBuffer and !Bitmap 3 - adding 'availability' semantic of 'onscreen' boolean, i.e. if onscree:=1 for a queried instance, the offscreen modes still indicate offscreen availability - see [4] 4 - avoiding explosion of the availability list due to [3], one Capability entry reflect on- and offscreen settings. Add FBO availability detection for EGL, WGL and OSX. Tested manually w/ 'TestGLCapabilities01NEWT' on X11 [NV, ATI], WGL[NV], OSX[NV]. --- src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java | 9 ++++++++- .../jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl/macosx') diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java index 82525cfde..55aea3a98 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java @@ -49,6 +49,7 @@ import javax.media.nativewindow.NativeSurface; import javax.media.nativewindow.NativeWindowFactory; import javax.media.nativewindow.OffscreenLayerSurface; import javax.media.nativewindow.ProxySurface; +import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLCapabilitiesImmutable; import javax.media.opengl.GLContext; import javax.media.opengl.GLException; @@ -495,8 +496,14 @@ public abstract class MacOSXCGLContext extends GLContextImpl CGL.setContextOpacity(ctx, 0); } - GLCapabilitiesImmutable fixedCaps = MacOSXCGLGraphicsConfiguration.NSPixelFormat2GLCapabilities(chosenCaps.getGLProfile(), pixelFormat); + GLCapabilities fixedCaps = MacOSXCGLGraphicsConfiguration.NSPixelFormat2GLCapabilities(chosenCaps.getGLProfile(), pixelFormat); fixedCaps = GLGraphicsConfigurationUtil.fixOpaqueGLCapabilities(fixedCaps, chosenCaps.isBackgroundOpaque()); + if(!fixedCaps.isPBuffer()) { + // not handled, so copy them + fixedCaps.setFBO(chosenCaps.isFBO()); + fixedCaps.setBitmap(chosenCaps.isBitmap()); + fixedCaps.setOnscreen(chosenCaps.isOnscreen()); + } config.setChosenCapabilities(fixedCaps); if(DEBUG) { System.err.println("NS create fixedCaps: "+fixedCaps); diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java index 202644bb3..10e8193e2 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java @@ -176,7 +176,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration return CGL.createPixelFormat(cglInternalAttributeToken, off, len, ivalues, 0); } - static GLCapabilitiesImmutable NSPixelFormat2GLCapabilities(GLProfile glp, long pixelFormat) { + static GLCapabilities NSPixelFormat2GLCapabilities(GLProfile glp, long pixelFormat) { return PixelFormat2GLCapabilities(glp, pixelFormat, true); } @@ -233,11 +233,11 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration return fmt.get(0); } - static GLCapabilitiesImmutable CGLPixelFormat2GLCapabilities(long pixelFormat) { + static GLCapabilities CGLPixelFormat2GLCapabilities(long pixelFormat) { return PixelFormat2GLCapabilities(null, pixelFormat, false); } - private static GLCapabilitiesImmutable PixelFormat2GLCapabilities(GLProfile glp, long pixelFormat, boolean nsUsage) { + private static GLCapabilities PixelFormat2GLCapabilities(GLProfile glp, long pixelFormat, boolean nsUsage) { int len = cglInternalAttributeToken.length; int off = 0; if ( !MacOSXCGLContext.isLionOrLater ) { -- cgit v1.2.3