aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/games/jogl/impl/macosx
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/java/games/jogl/impl/macosx')
-rw-r--r--src/net/java/games/jogl/impl/macosx/MacOSXDummyGLContext.java2
-rw-r--r--src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java15
-rw-r--r--src/net/java/games/jogl/impl/macosx/MacOSXGLContextFactory.java9
-rw-r--r--src/net/java/games/jogl/impl/macosx/MacOSXOffscreenGLContext.java6
-rw-r--r--src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java20
5 files changed, 39 insertions, 13 deletions
diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXDummyGLContext.java b/src/net/java/games/jogl/impl/macosx/MacOSXDummyGLContext.java
index 05ed7d9dc..02ca808c9 100644
--- a/src/net/java/games/jogl/impl/macosx/MacOSXDummyGLContext.java
+++ b/src/net/java/games/jogl/impl/macosx/MacOSXDummyGLContext.java
@@ -54,7 +54,7 @@ class MacOSXDummyGLContext extends MacOSXGLContext
private MacOSXGLImpl gl;
MacOSXDummyGLContext(MacOSXGLImpl gl) {
- super(null, null, null);
+ super(null, null, null, null);
this.gl = gl;
}
diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java b/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java
index d35392ac1..53e5986ec 100644
--- a/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java
+++ b/src/net/java/games/jogl/impl/macosx/MacOSXGLContext.java
@@ -53,9 +53,12 @@ public abstract class MacOSXGLContext extends GLContext
// OpenGL functions.
private GLProcAddressTable glProcAddressTable;
- public MacOSXGLContext(Component component, GLCapabilities capabilities, GLCapabilitiesChooser chooser)
+ public MacOSXGLContext(Component component,
+ GLCapabilities capabilities,
+ GLCapabilitiesChooser chooser,
+ GLContext shareWith)
{
- super(component, capabilities, chooser);
+ super(component, capabilities, chooser, shareWith);
}
protected String mapToRealGLFunctionName(String glFunctionName)
@@ -96,6 +99,10 @@ public abstract class MacOSXGLContext extends GLContext
protected long dynamicLookupFunction(String glFuncName) {
return CGL.getProcAddress(glFuncName);
}
+
+ public boolean isCreated() {
+ return (nsContext != 0);
+ }
protected void resetGLFunctionAvailability()
{
@@ -125,6 +132,10 @@ public abstract class MacOSXGLContext extends GLContext
// Internals only below this point
//
+ protected long getNSContext() {
+ return nsContext;
+ }
+
protected JAWT getJAWT()
{
if (jawt == null)
diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXGLContextFactory.java b/src/net/java/games/jogl/impl/macosx/MacOSXGLContextFactory.java
index 323f75480..f3e002c22 100644
--- a/src/net/java/games/jogl/impl/macosx/MacOSXGLContextFactory.java
+++ b/src/net/java/games/jogl/impl/macosx/MacOSXGLContextFactory.java
@@ -44,11 +44,14 @@ import net.java.games.jogl.*;
import net.java.games.jogl.impl.*;
public class MacOSXGLContextFactory extends GLContextFactory {
- public GLContext createGLContext(Component component, GLCapabilities capabilities, GLCapabilitiesChooser chooser) {
+ public GLContext createGLContext(Component component,
+ GLCapabilities capabilities,
+ GLCapabilitiesChooser chooser,
+ GLContext shareWith) {
if (component != null) {
- return new MacOSXOnscreenGLContext(component, capabilities, chooser);
+ return new MacOSXOnscreenGLContext(component, capabilities, chooser, shareWith);
} else {
- return new MacOSXOffscreenGLContext(capabilities, chooser);
+ return new MacOSXOffscreenGLContext(capabilities, chooser, shareWith);
}
}
}
diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXOffscreenGLContext.java b/src/net/java/games/jogl/impl/macosx/MacOSXOffscreenGLContext.java
index 46d754462..e9f3bed24 100644
--- a/src/net/java/games/jogl/impl/macosx/MacOSXOffscreenGLContext.java
+++ b/src/net/java/games/jogl/impl/macosx/MacOSXOffscreenGLContext.java
@@ -49,8 +49,10 @@ public class MacOSXOffscreenGLContext extends MacOSXGLContext
private int width;
private int height;
- public MacOSXOffscreenGLContext(GLCapabilities capabilities, GLCapabilitiesChooser chooser) {
- super(null, capabilities, chooser);
+ public MacOSXOffscreenGLContext(GLCapabilities capabilities,
+ GLCapabilitiesChooser chooser,
+ GLContext shareWith) {
+ super(null, capabilities, chooser, shareWith);
System.err.println("MacOSXOffscreenGLContext not implemented yet");
}
diff --git a/src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java b/src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java
index 5b0df9052..8f75fd561 100644
--- a/src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java
+++ b/src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java
@@ -53,8 +53,11 @@ public class MacOSXOnscreenGLContext extends MacOSXGLContext {
private long nsView; // NSView
private Runnable myDeferredReshapeAction;
- public MacOSXOnscreenGLContext(Component component, GLCapabilities capabilities, GLCapabilitiesChooser chooser) {
- super(component, capabilities, chooser);
+ public MacOSXOnscreenGLContext(Component component,
+ GLCapabilities capabilities,
+ GLCapabilitiesChooser chooser,
+ GLContext shareWith) {
+ super(component, capabilities, chooser, shareWith);
}
public synchronized void invokeGL(final Runnable runnable, boolean isReshape, Runnable initAction) throws GLException {
@@ -121,12 +124,19 @@ public class MacOSXOnscreenGLContext extends MacOSXGLContext {
}
protected void create() {
- nsContext = CGL.createContext(nsView);
+ MacOSXGLContext other = (MacOSXGLContext) GLContextShareSet.getShareContext(this);
+ long share = 0;
+ if (other != null) {
+ share = other.getNSContext();
+ if (share == 0) {
+ throw new GLException("GLContextShareSet returned an invalid OpenGL context");
+ }
+ }
+ nsContext = CGL.createContext(nsView, share);
if (nsContext == 0) {
throw new GLException("Error creating nsContext");
}
- // FIXME
- //choosePixelFormatAndCreateContext(true);
+ GLContextShareSet.contextCreated(this);
}
protected synchronized boolean makeCurrent(Runnable initAction) throws GLException {