aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2003-07-08 09:20:04 +0000
committerKenneth Russel <[email protected]>2003-07-08 09:20:04 +0000
commit4f936be964c9e8613a5e43e1d88490ff7f550ec9 (patch)
tree74a2c01c6093d89ac123d08642b11a2007cc99e2 /src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java
parent93d272a0525ec57aa3cd584f15cde6cf2a637e0c (diff)
Added sharing of display lists and textures among OpenGL contexts
through new methods in GLDrawableFactory; GLContext has not been exposed in the public API. Tested with new simple TestContextSharing demonstration on Windows, Linux and Mac OS X. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@18 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java')
-rw-r--r--src/net/java/games/jogl/impl/macosx/MacOSXOnscreenGLContext.java20
1 files changed, 15 insertions, 5 deletions
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 {