aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java19
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java11
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java5
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java13
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXJava2DCGLContext.java11
6 files changed, 35 insertions, 28 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java
index 9182a71de..ebefaf466 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java
@@ -88,11 +88,13 @@ public abstract class MacOSXCGLContext extends GLContextImpl
protected Map/*<String, String>*/ getExtensionNameMap() { return null; }
- protected abstract boolean create();
+ protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) {
+ return 0; // FIXME
+ }
- protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) {
- return 0; // FIXME
- }
+ protected void destroyContextARBImpl(long _context) {
+ // FIXME
+ }
/**
* Creates and initializes an appropriate OpenGl nsContext. Should only be
@@ -154,7 +156,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
if (!CGL.makeCurrentContext(nsContext)) {
throw new GLException("Error making nsContext current");
}
- setGLFunctionAvailability(true, 0, 0, 0);
+ setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT|CTX_OPTION_ANY);
GLContextShareSet.contextCreated(this);
return true;
}
@@ -165,13 +167,14 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
boolean created = false;
if ( 0 == cglContext && 0 == nsContext) {
- if (!create()) {
+ create();
+ created = 0 != cglContext || 0 != nsContext ;
+ if(!created) {
return CONTEXT_NOT_CURRENT;
}
if (DEBUG) {
System.err.println("!!! Created OpenGL context " + toHexString(nsContext) + " for " + getClass().getName());
}
- created = true;
}
if ( 0 != cglContext ) {
@@ -185,7 +188,7 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
if (created) {
- setGLFunctionAvailability(false, -1, -1, -1);
+ setGLFunctionAvailability(false, -1, -1, CTX_PROFILE_COMPAT|CTX_OPTION_ANY);
return CONTEXT_CURRENT_NEW;
}
return CONTEXT_CURRENT;
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java
index 906088642..d10434252 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java
@@ -43,8 +43,10 @@ import com.jogamp.common.os.DynamicLookupHelper;
import java.nio.*;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
+import com.jogamp.common.JogampRuntimeException;
+import com.jogamp.common.util.*;
import com.jogamp.opengl.impl.*;
-import com.jogamp.nativewindow.impl.*;
+import com.jogamp.nativewindow.impl.NullWindow;
public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl implements DynamicLookupHelper {
public MacOSXCGLDrawableFactory() {
@@ -55,11 +57,14 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl implements D
new MacOSXCGLGraphicsConfigurationFactory();
try {
- NWReflection.createInstance("com.jogamp.opengl.impl.macosx.cgl.awt.MacOSXAWTCGLGraphicsConfigurationFactory",
+ ReflectionUtil.createInstance("com.jogamp.opengl.impl.macosx.cgl.awt.MacOSXAWTCGLGraphicsConfigurationFactory",
new Object[] {});
- } catch (Throwable t) { }
+ } catch (JogampRuntimeException jre) { /* n/a .. */ }
}
+ protected final GLDrawableImpl getSharedDrawable() { return null; }
+ protected final GLContextImpl getSharedContext() { return null; }
+
public GLDrawableImpl createOnscreenDrawable(NativeWindow target) {
if (target == null) {
throw new IllegalArgumentException("Null target");
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java
index 248bbb4d6..eba3cf50e 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java
@@ -56,7 +56,7 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext {
this.cglContext = cglContext;
this.nsContext = nsContext;
GLContextShareSet.contextCreated(this);
- setGLFunctionAvailability(false, 0, 0, 0);
+ setGLFunctionAvailability(false, 0, 0, CTX_PROFILE_COMPAT|CTX_OPTION_ANY);
getGLStateTracker().setEnabled(false); // external context usage can't track state in Java
}
@@ -110,8 +110,7 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext {
}
}
- protected boolean create() {
- return true;
+ protected void create() {
}
public int makeCurrent() throws GLException {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java
index 4c64864fa..c4eaee489 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXOnscreenCGLContext.java
@@ -115,8 +115,8 @@ public class MacOSXOnscreenCGLContext extends MacOSXCGLContext {
CGL.updateContext(nsContext);
}
- protected boolean create() {
- return create(false, false);
+ protected void create() {
+ create(false, false);
}
public void setOpenGLMode(int mode) {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java
index 5844b8edd..e90672a1d 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXPbufferCGLContext.java
@@ -59,13 +59,14 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
boolean created = false;
if (nsContext == 0) {
- if (!create()) {
+ create();
+ created = 0 != nsContext ;
+ if(!created) {
return CONTEXT_NOT_CURRENT;
}
if (DEBUG) {
System.err.println("!!! Created OpenGL context " + toHexString(nsContext) + " for " + getClass().getName());
}
- created = true;
}
if (!impl.makeCurrent(nsContext)) {
@@ -73,7 +74,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
}
if (created) {
- setGLFunctionAvailability(false, -1, -1, -1);
+ setGLFunctionAvailability(false, -1, -1, CTX_PROFILE_COMPAT|CTX_OPTION_ANY);
// Initialize render-to-texture support if requested
DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
@@ -134,7 +135,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
return GLPbuffer.APPLE_FLOAT;
}
- protected boolean create() {
+ protected void create() {
DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) drawable.getNativeWindow().getGraphicsConfiguration().getNativeGraphicsConfiguration();
GLCapabilities capabilities = (GLCapabilities)config.getChosenCapabilities();
if (capabilities.getPbufferFloatingPointBuffers() &&
@@ -152,9 +153,7 @@ public class MacOSXPbufferCGLContext extends MacOSXCGLContext {
if (!impl.makeCurrent(nsContext)) {
throw new GLException("Error making nsContext current");
}
- setGLFunctionAvailability(true, 0, 0, 0);
-
- return true;
+ setGLFunctionAvailability(true, 0, 0, CTX_PROFILE_COMPAT|CTX_OPTION_ANY);
}
//---------------------------------------------------------------------------
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXJava2DCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXJava2DCGLContext.java
index 9189b41f3..97a1435bc 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXJava2DCGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXJava2DCGLContext.java
@@ -73,7 +73,9 @@ public class MacOSXJava2DCGLContext extends MacOSXCGLContext implements Java2DGL
protected int makeCurrentImpl() throws GLException {
boolean created = false;
if (nsContext == 0) {
- if (!create()) {
+ create();
+ created = 0 != nsContext ;
+ if(!created) {
return CONTEXT_NOT_CURRENT;
}
if (DEBUG) {
@@ -87,13 +89,13 @@ public class MacOSXJava2DCGLContext extends MacOSXCGLContext implements Java2DGL
}
if (created) {
- setGLFunctionAvailability(false, -1, -1, -1);
+ setGLFunctionAvailability(false, -1, -1, CTX_PROFILE_COMPAT|CTX_OPTION_ANY);
return CONTEXT_CURRENT_NEW;
}
return CONTEXT_CURRENT;
}
- protected boolean create() {
+ protected void create() {
// Find and configure share context
MacOSXCGLContext other = (MacOSXCGLContext) GLContextShareSet.getShareContext(this);
long share = 0;
@@ -119,11 +121,10 @@ public class MacOSXJava2DCGLContext extends MacOSXCGLContext implements Java2DGL
long ctx = Java2D.createOGLContextOnSurface(graphics, share);
if (ctx == 0) {
- return false;
+ return;
}
// FIXME: think about GLContext sharing
nsContext = ctx;
- return true;
}
protected void releaseImpl() throws GLException {