aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/macosx/cgl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/macosx/cgl')
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java26
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java14
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java25
4 files changed, 46 insertions, 23 deletions
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
index 0dd1a460e..522640294 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
@@ -366,7 +366,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
destroyImpl();
((MacOSXCGLDrawable)drawable).setOpenGLMode(mode);
if (DEBUG) {
- System.err.println("Switching context mode " + openGLMode + " -> " + mode);
+ System.err.println("MacOSXCGLContext: Switching context mode " + openGLMode + " -> " + mode);
}
initOpenGLImpl(mode);
openGLMode = mode;
@@ -414,11 +414,15 @@ public abstract class MacOSXCGLContext extends GLContextImpl
final GLCapabilitiesImmutable chosenCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities();
long pixelFormat = MacOSXCGLGraphicsConfiguration.GLCapabilities2NSPixelFormat(chosenCaps, ctp, major, minor);
if (pixelFormat == 0) {
- throw new GLException("Unable to allocate pixel format with requested GLCapabilities");
+ if(DEBUG) {
+ System.err.println("Unable to allocate pixel format with requested GLCapabilities: "+chosenCaps);
+ }
+ return 0;
}
config.setChosenPixelFormat(pixelFormat);
if(DEBUG) {
System.err.println("NS create OSX>=lion "+isLionOrLater);
+ System.err.println("NS create backendType: "+drawable.getOpenGLMode());
System.err.println("NS create backingLayerHost: "+backingLayerHost);
System.err.println("NS create share: "+share);
System.err.println("NS create chosenCaps: "+chosenCaps);
@@ -532,7 +536,14 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
public boolean release(long ctx) {
- gl.glFinish(); // w/o glFinish() OSX < 10.7 (NVidia driver) may freeze
+ try {
+ gl.glFinish(); // w/o glFinish() OSX < 10.7 (NVidia driver) may freeze
+ } catch (GLException gle) {
+ if(DEBUG) {
+ System.err.println("MacOSXCGLContext.NSOpenGLImpl.release: INFO: glFinish() catched exception:");
+ gle.printStackTrace();
+ }
+ }
final boolean res = CGL.clearCurrentContext(ctx);
final long cglCtx = CGL.getCGLContext(ctx);
if(0 == cglCtx) {
@@ -636,7 +647,14 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
public boolean release(long ctx) {
- gl.glFinish(); // w/o glFinish() OSX < 10.7 (NVidia driver) may freeze
+ try {
+ gl.glFinish(); // w/o glFinish() OSX < 10.7 (NVidia driver) may freeze
+ } catch (GLException gle) {
+ if(DEBUG) {
+ System.err.println("MacOSXCGLContext.CGLImpl.release: INFO: glFinish() catched exception:");
+ gle.printStackTrace();
+ }
+ }
int err = CGL.CGLSetCurrentContext(0);
if(DEBUG && CGL.kCGLNoError != err) {
System.err.println("CGL: Could not release current context: err 0x"+Integer.toHexString(err)+": "+this);
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java
index 12d480fd1..7b5efc31a 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java
@@ -106,7 +106,7 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl {
}
protected long getNSViewHandle() {
- return GLBackendType.NSOPENGL == openGLMode ? getHandle() : null;
+ return GLBackendType.NSOPENGL == openGLMode ? getHandle() : 0;
}
protected void registerContext(MacOSXCGLContext ctx) {
@@ -151,7 +151,7 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl {
destroyImpl();
if (DEBUG) {
- System.err.println("Switching context mode " + openGLMode + " -> " + mode);
+ System.err.println("MacOSXCGLDrawable: Switching context mode " + openGLMode + " -> " + mode);
}
initOpenGLImpl(mode);
openGLMode = mode;
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
index 3dd7a7f08..5c6486799 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java
@@ -210,6 +210,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
}
final GLCapabilities caps = new GLCapabilities(glp);
caps.setRedBits(5); caps.setGreenBits(5); caps.setBlueBits(5); caps.setAlphaBits(0);
+ caps.setDepthBits(5);
caps.setDoubleBuffered(false);
caps.setOnscreen(false);
caps.setPBuffer(true);
@@ -230,11 +231,18 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
}
} catch (GLException gle) {
if (DEBUG) {
- System.err.println("MacOSXCGLDrawableFactory.createShared: INFO: makeCurrent failed");
+ System.err.println("MacOSXCGLDrawableFactory.createShared: INFO: makeCurrent catched exception:");
gle.printStackTrace();
}
} finally {
- context.destroy();
+ try {
+ context.destroy();
+ } catch (GLException gle) {
+ if (DEBUG) {
+ System.err.println("MacOSXCGLDrawableFactory.createShared: INFO: destroy catched exception:");
+ gle.printStackTrace();
+ }
+ }
}
}
drawable.destroy();
@@ -265,7 +273,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
}
} catch (GLException gle) {
if(DEBUG) {
- System.err.println("Catched Exception while MaxOSXCGL Shared Resource initialization");
+ System.err.println("Catched Exception while MaxOSXCGL Shared Resource initialization:");
gle.printStackTrace();
}
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java
index f552ab3dd..efab37e1b 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java
@@ -78,10 +78,10 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration
}
static final int[] cglInternalAttributeToken = new int[] {
- CGL.kCGLPFAOpenGLProfile,
- CGL.kCGLPFAColorFloat,
+ CGL.kCGLPFAOpenGLProfile, // >= lion
+ CGL.NSOpenGLPFAAccelerated, // query only (prefer accelerated, but allow non accelerated), ignored for createPixelformat
CGL.NSOpenGLPFANoRecovery,
- CGL.NSOpenGLPFAAccelerated,
+ CGL.kCGLPFAColorFloat,
CGL.NSOpenGLPFAPixelBuffer,
CGL.NSOpenGLPFADoubleBuffer,
CGL.NSOpenGLPFAStereo,
@@ -109,17 +109,14 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration
case CGL.kCGLPFAOpenGLProfile:
ivalues[idx] = MacOSXCGLContext.GLProfile2CGLOGLProfileValue(ctp, major, minor);
break;
- case CGL.kCGLPFAColorFloat:
- ivalues[idx] = caps.getPbufferFloatingPointBuffers() ? 1 : 0;
- break;
-
case CGL.NSOpenGLPFANoRecovery:
ivalues[idx] = caps.getHardwareAccelerated() ? 1 : 0;
break;
- case CGL.NSOpenGLPFAAccelerated:
- ivalues[idx] = caps.getHardwareAccelerated() ? 1 : 0;
- break;
+ case CGL.kCGLPFAColorFloat:
+ ivalues[idx] = caps.getPbufferFloatingPointBuffers() ? 1 : 0;
+ break;
+
case CGL.NSOpenGLPFAPixelBuffer:
ivalues[idx] = caps.isPBuffer() ? 1 : 0;
break;
@@ -287,14 +284,14 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration
for (int i = 0; i < len; i++) {
int attr = cglInternalAttributeToken[i+off];
switch (attr) {
- case CGL.kCGLPFAColorFloat:
- caps.setPbufferFloatingPointBuffers(ivalues[i] != 0);
- break;
-
case CGL.NSOpenGLPFAAccelerated:
caps.setHardwareAccelerated(ivalues[i] != 0);
break;
+ case CGL.kCGLPFAColorFloat:
+ caps.setPbufferFloatingPointBuffers(ivalues[i] != 0);
+ break;
+
case CGL.NSOpenGLPFAPixelBuffer:
caps.setPBuffer(ivalues[i] != 0);
break;