aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/com/jogamp/opengl/impl/macosx
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/classes/com/jogamp/opengl/impl/macosx')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLContext.java16
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java38
2 files changed, 43 insertions, 11 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 f9934fe20..e9b543721 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
@@ -224,19 +224,18 @@ public abstract class MacOSXCGLContext extends GLContextImpl
}
}
- protected void updateGLProcAddressTable(int major, int minor, int ctp) {
+ protected final void updateGLXProcAddressTable(int major, int minor, int ctp) {
if (DEBUG) {
System.err.println(getThreadName() + ": !!! Initializing CGL extension address table");
}
- int key = compose8bit(major, minor, ctp, 0);
CGLExtProcAddressTable table = null;
- synchronized(mappedProcAddressLock) {
- table = (CGLExtProcAddressTable) mappedGLXProcAddress.get( key );
+ synchronized(mappedContextTypeObjectLock) {
+ table = (CGLExtProcAddressTable) mappedGLXProcAddress.get( contextFQN );
}
if(null != table) {
cglExtProcAddressTable = table;
if(DEBUG) {
- System.err.println(getThreadName() + ": !!! GLContext CGL ProcAddressTable reusing key("+major+","+minor+","+ctp+") -> "+table.hashCode());
+ System.err.println(getThreadName() + ": !!! GLContext CGL ProcAddressTable reusing key("+contextFQN+") -> "+table.hashCode());
}
} else {
if (cglExtProcAddressTable == null) {
@@ -245,14 +244,13 @@ public abstract class MacOSXCGLContext extends GLContextImpl
cglExtProcAddressTable = new CGLExtProcAddressTable(new GLProcAddressResolver());
}
resetProcAddressTable(getCGLExtProcAddressTable());
- synchronized(mappedProcAddressLock) {
- mappedGLXProcAddress.put(key, getCGLExtProcAddressTable());
+ synchronized(mappedContextTypeObjectLock) {
+ mappedGLXProcAddress.put(contextFQN, getCGLExtProcAddressTable());
if(DEBUG) {
- System.err.println(getThreadName() + ": !!! GLContext CGL ProcAddressTable mapping key("+major+","+minor+","+ctp+") -> "+getCGLExtProcAddressTable().hashCode());
+ System.err.println(getThreadName() + ": !!! GLContext CGL ProcAddressTable mapping key("+contextFQN+") -> "+getCGLExtProcAddressTable().hashCode());
}
}
}
- super.updateGLProcAddressTable(major, minor, ctp);
}
public String getPlatformExtensionsString()
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 9a02e55ee..f41b68d31 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
@@ -47,6 +47,8 @@ import com.jogamp.common.JogampRuntimeException;
import com.jogamp.common.util.*;
import com.jogamp.opengl.impl.*;
import com.jogamp.nativewindow.impl.ProxySurface;
+import java.util.HashMap;
+import javax.media.nativewindow.macosx.MacOSXGraphicsDevice;
public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
private static final DesktopGLDynamicLookupHelper macOSXCGLDynamicLookupHelper;
@@ -83,11 +85,43 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
null, getClass().getClassLoader());
} catch (JogampRuntimeException jre) { /* n/a .. */ }
}
+
+ /** FIXME:
+ * find out the Windows semantics of a device connection {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection()}
+ * to actually use multiple devices.
+ */
+ defaultDevice = new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_CONNECTION);
+ }
+
+ static class SharedResource {
+ private MacOSXCGLDrawable drawable;
+ private MacOSXCGLContext context;
+
+ SharedResource(MacOSXCGLDrawable draw, MacOSXCGLContext ctx) {
+ drawable = draw;
+ context = ctx;
+ }
+ }
+ HashMap/*<connection, SharedResource>*/ sharedMap = new HashMap();
+ MacOSXGraphicsDevice defaultDevice;
+
+ public final AbstractGraphicsDevice getDefaultDevice() {
+ return defaultDevice;
+ }
+
+ public final boolean getIsDeviceCompatible(AbstractGraphicsDevice device) {
+ if(device instanceof MacOSXGraphicsDevice) {
+ return true;
+ }
+ return false;
+ }
+
+ protected final GLContext getOrCreateSharedContextImpl(AbstractGraphicsDevice device) {
+ // FIXME: not implemented .. needs a dummy OSX surface
+ return null;
}
protected void shutdownInstance() {}
- protected final GLDrawableImpl getSharedDrawable() { return null; }
- protected final GLContextImpl getSharedContext() { return null; }
protected GLDrawableImpl createOnscreenDrawableImpl(NativeSurface target) {
if (target == null) {