aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-11-15 03:53:22 +0100
committerSven Gothel <[email protected]>2010-11-15 03:53:22 +0100
commit35d1c40fe89311f88c7303930e172adcc5d6853a (patch)
tree383f74cbd782f32d194b7f893a5365fa86093ac7
parent2c1a870f56f54df3e96d68e3d5dadee0bcae7cb5 (diff)
NativeWindow AbstractGraphicsDevice: Add 'unitID' attribute and getUniqueID()
Preparation to support multiple devices on one machine, hence adding the unitID a unique ID/index of the associated GPU, or GPU affinity. Adding getUniqueID() to return a cached semantic unique string id for the device. This was removed from the temp. impl in JOGL's GLContext, added unitID. All other changes just adapt to the above.
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfigurationFactory.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java2
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java8
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java4
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java4
-rw-r--r--src/jogl/classes/javax/media/opengl/GLContext.java12
-rw-r--r--src/jogl/classes/javax/media/opengl/GLProfile.java4
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLCanvas.java2
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java33
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java29
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java8
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java12
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsConfiguration.java4
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsDevice.java11
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsScreen.java11
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/egl/EGLGraphicsDevice.java13
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/macosx/MacOSXGraphicsDevice.java15
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/windows/WindowsGraphicsDevice.java15
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsDevice.java14
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/awt/AWTCanvas.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/awt/AWTDisplay.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/intel/gdl/Display.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/macosx/MacDisplay.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/opengl/broadcom/egl/Display.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/opengl/kd/KDDisplay.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/windows/WindowsDisplay.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/x11/X11Display.java2
36 files changed, 135 insertions, 120 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java
index f9fcdb29c..81dcc12d5 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java
@@ -166,7 +166,7 @@ public abstract class EGLDrawable extends GLDrawableImpl {
if (!EGL.eglInitialize(eglDisplay, null, null)) {
throw new GLException("eglInitialize failed"+", error 0x"+Integer.toHexString(EGL.eglGetError()));
}
- EGLGraphicsDevice e = new EGLGraphicsDevice(eglDisplay);
+ EGLGraphicsDevice e = new EGLGraphicsDevice(eglDisplay, AbstractGraphicsDevice.DEFAULT_UNIT);
DefaultGraphicsScreen s = new DefaultGraphicsScreen(e, aConfig.getScreen().getIndex());
GLCapabilities caps = (GLCapabilities) aConfig.getChosenCapabilities(); // yes, use the already choosen Capabilities (x11,win32,..)
eglConfig = (EGLGraphicsConfiguration) GraphicsConfigurationFactory.getFactory(e).chooseGraphicsConfiguration(caps, null, s);
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java
index c7e0a0417..3c8c4c98f 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java
@@ -95,11 +95,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
public EGLDrawableFactory() {
super();
- /** FIXME:
- * find out the Windows semantics of a device connection {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection()}
- * to actually use multiple devices.
- */
- defaultDevice = new EGLGraphicsDevice(AbstractGraphicsDevice.DEFAULT_CONNECTION);
+ defaultDevice = new EGLGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
}
static class SharedResource {
@@ -174,7 +170,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl {
}
protected GLContext createExternalGLContextImpl() {
- AbstractGraphicsScreen absScreen = DefaultGraphicsScreen.createScreenDevice(AbstractGraphicsDevice.EXTERNAL_CONNECTION, 0);
+ AbstractGraphicsScreen absScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_EGL);
return new EGLExternalContext(absScreen);
}
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfigurationFactory.java
index 88e8a9ed1..c678707fc 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfigurationFactory.java
@@ -282,7 +282,7 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor
if (!EGL.eglInitialize(eglDisplay, null, null)) {
throw new GLException("eglInitialize failed"+", error 0x"+Integer.toHexString(EGL.eglGetError()));
}
- EGLGraphicsDevice e = new EGLGraphicsDevice(eglDisplay);
+ EGLGraphicsDevice e = new EGLGraphicsDevice(eglDisplay, AbstractGraphicsDevice.DEFAULT_UNIT);
DefaultGraphicsScreen s = new DefaultGraphicsScreen(e, 0);
EGLGraphicsConfiguration eglConfig = chooseGraphicsConfigurationStatic(caps, chooser, s);
if (null == eglConfig) {
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 7981e7ba2..a8a82b46a 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
@@ -86,11 +86,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
} 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);
+ defaultDevice = new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
}
static class SharedResource {
@@ -156,7 +152,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl {
}
protected NativeSurface createOffscreenSurfaceImpl(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) {
- AbstractGraphicsScreen screen = DefaultGraphicsScreen.createDefault();
+ AbstractGraphicsScreen screen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_MACOSX);
ProxySurface ns = new ProxySurface(MacOSXCGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capabilities, chooser, screen, true));
ns.setSize(width, height);
return ns;
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 973c67127..5dcc103b2 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
@@ -97,7 +97,7 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext {
System.err.println("MacOSXExternalCGLContext Create "+caps);
}
- AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault();
+ AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_MACOSX);
MacOSXCGLGraphicsConfiguration cfg = new MacOSXCGLGraphicsConfiguration(aScreen, caps, caps, pixelFormat);
ProxySurface ns = new ProxySurface(cfg);
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java
index 6a9617d27..af8841d3d 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java
@@ -62,7 +62,7 @@ public class MacOSXAWTCGLGraphicsConfigurationFactory extends GraphicsConfigurat
}
if(null==absScreen) {
- absScreen = AWTGraphicsScreen.createScreenDevice(-1);
+ absScreen = AWTGraphicsScreen.createScreenDevice(-1, AbstractGraphicsDevice.DEFAULT_UNIT);
}
AWTGraphicsScreen awtScreen = (AWTGraphicsScreen) absScreen;
device = ((AWTGraphicsDevice)awtScreen.getDevice()).getGraphicsDevice();
@@ -83,7 +83,7 @@ public class MacOSXAWTCGLGraphicsConfigurationFactory extends GraphicsConfigurat
long displayHandle = 0;
- MacOSXGraphicsDevice macDevice = new MacOSXGraphicsDevice();
+ MacOSXGraphicsDevice macDevice = new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
DefaultGraphicsScreen macScreen = new DefaultGraphicsScreen(macDevice, awtScreen.getIndex());
if(DEBUG) {
System.err.println("MacOSXAWTCGLGraphicsConfigurationFactory: made "+macScreen);
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java
index 9917ea901..5ac937be8 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java
@@ -75,7 +75,7 @@ public class WindowsExternalWGLContext extends WindowsWGLContext {
throw new GLException("Error: attempted to make an external GLContext without a valid pixelformat");
}
- AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault();
+ AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_WINDOWS);
WindowsWGLGraphicsConfiguration cfg = WindowsWGLGraphicsConfiguration.create(hdc, pfdID, glp, aScreen, true, true);
ProxySurface ns = new ProxySurface(cfg);
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java
index 19fe8f03c..ec0bd7c7a 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java
@@ -61,7 +61,7 @@ public class WindowsExternalWGLDrawable extends WindowsWGLDrawable {
throw new GLException("Error: attempted to make an external GLContext without a valid pixelformat");
}
- AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault();
+ AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_WINDOWS);
WindowsWGLGraphicsConfiguration cfg = WindowsWGLGraphicsConfiguration.create(hdc, pfdID, glp, aScreen, true, true);
ProxySurface ns = new ProxySurface(cfg);
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java
index 850cf5542..64dd0eb46 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java
@@ -87,11 +87,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
} 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 WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_CONNECTION);
+ defaultDevice = new WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
}
static class SharedResource {
@@ -261,7 +257,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl {
}
protected final NativeSurface createOffscreenSurfaceImpl(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) {
- AbstractGraphicsScreen screen = DefaultGraphicsScreen.createDefault();
+ AbstractGraphicsScreen screen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_WINDOWS);
ProxySurface ns = new ProxySurface(WindowsWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(
capabilities, chooser, screen) );
ns.setSize(width, height);
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
index d34467fb1..372630446 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java
@@ -65,7 +65,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
caps.setPBuffer (usePBuffer);
if(null==absScreen) {
- absScreen = DefaultGraphicsScreen.createScreenDevice(AbstractGraphicsDevice.DEFAULT_CONNECTION, 0);
+ absScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_WINDOWS);
}
return new WindowsWGLGraphicsConfiguration(absScreen, caps, caps, WindowsWGLGraphicsConfiguration.GLCapabilities2PFD(caps), -1, null);
@@ -75,7 +75,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio
CapabilitiesChooser chooser,
AbstractGraphicsScreen absScreen) {
if(null==absScreen) {
- absScreen = DefaultGraphicsScreen.createScreenDevice(AbstractGraphicsDevice.DEFAULT_CONNECTION, 0);
+ absScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_WINDOWS);
}
GLCapabilities caps2 = (GLCapabilities) caps.clone();
if(!caps2.isOnscreen()) {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java
index 26704acf3..48850440d 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java
@@ -62,7 +62,7 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GraphicsConfigura
}
if(null==absScreen) {
- absScreen = AWTGraphicsScreen.createScreenDevice(-1);
+ absScreen = AWTGraphicsScreen.createScreenDevice(-1, AbstractGraphicsDevice.DEFAULT_UNIT);
}
AWTGraphicsScreen awtScreen = (AWTGraphicsScreen) absScreen;
device = ((AWTGraphicsDevice)awtScreen.getDevice()).getGraphicsDevice();
@@ -88,7 +88,7 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GraphicsConfigura
long displayHandle = 0;
- WindowsGraphicsDevice winDevice = new WindowsGraphicsDevice();
+ WindowsGraphicsDevice winDevice = new WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
DefaultGraphicsScreen winScreen = new DefaultGraphicsScreen(winDevice, awtScreen.getIndex());
if(DEBUG) {
System.err.println("WindowsAWTWGLGraphicsConfigurationFactory: made "+winScreen);
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java
index ddfae1f4c..d98d8a436 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java
@@ -87,7 +87,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
} catch (JogampRuntimeException jre) { /* n/a .. */ }
}
- defaultDevice = new X11GraphicsDevice(X11Util.getNullDisplayName());
+ defaultDevice = new X11GraphicsDevice(X11Util.getNullDisplayName(), AbstractGraphicsDevice.DEFAULT_UNIT);
// Init shared resources via own thread
// Will be released via ShutdownHook
@@ -204,7 +204,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl {
}
private final SharedResource createSharedResource(String connection) {
- X11GraphicsDevice sharedDevice = new X11GraphicsDevice(X11Util.createDisplay(connection));
+ X11GraphicsDevice sharedDevice = new X11GraphicsDevice(X11Util.createDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT);
sharedDevice.setCloseDisplay(true);
X11Util.lockDefaultToolkit(sharedDevice.getHandle()); // OK
try {
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java
index 4b5b72cc6..d4af56aca 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java
@@ -59,7 +59,7 @@ public class X11AWTGLXGraphicsConfigurationFactory extends GraphicsConfiguration
}
if(null==absScreen) {
- absScreen = AWTGraphicsScreen.createScreenDevice(-1);
+ absScreen = AWTGraphicsScreen.createScreenDevice(-1, AbstractGraphicsDevice.DEFAULT_UNIT);
}
AWTGraphicsScreen awtScreen = (AWTGraphicsScreen) absScreen;
device = ((AWTGraphicsDevice)awtScreen.getDevice()).getGraphicsDevice();
@@ -95,7 +95,7 @@ public class X11AWTGLXGraphicsConfigurationFactory extends GraphicsConfiguration
displayHandle = X11Util.createDisplay(name);
}
((AWTGraphicsDevice)awtScreen.getDevice()).setSubType(NativeWindowFactory.TYPE_X11, displayHandle);
- X11GraphicsDevice x11Device = new X11GraphicsDevice(displayHandle);
+ X11GraphicsDevice x11Device = new X11GraphicsDevice(displayHandle, AbstractGraphicsDevice.DEFAULT_UNIT);
x11Device.setCloseDisplay(true);
X11GraphicsScreen x11Screen = new X11GraphicsScreen(x11Device, awtScreen.getIndex());
if(DEBUG) {
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java
index 34ac8e93b..45e1361fb 100644
--- a/src/jogl/classes/javax/media/opengl/GLContext.java
+++ b/src/jogl/classes/javax/media/opengl/GLContext.java
@@ -557,26 +557,22 @@ public abstract class GLContext {
private static /*final*/ HashSet/*<UniqueDeviceString>*/ deviceVersionsAvailableSet = new HashSet();
protected static String getContextFQN(AbstractGraphicsDevice device, int major, int minor, int ctp) {
- return getUniqueDeviceString(device) + "-" + toHexString(compose8bit(major, minor, ctp, 0));
+ return device.getUniqueID() + "-" + toHexString(compose8bit(major, minor, ctp, 0));
}
protected static String getDeviceVersionAvailableKey(AbstractGraphicsDevice device, int major, int profile) {
- return getUniqueDeviceString(device) + "-" + toHexString(compose8bit(major, profile, 0, 0));
- }
-
- protected static String getUniqueDeviceString(AbstractGraphicsDevice device) {
- return device.getType() + "_" + device.getConnection() ;
+ return device.getUniqueID() + "-" + toHexString(compose8bit(major, profile, 0, 0));
}
protected static boolean getAvailableGLVersionsSet(AbstractGraphicsDevice device) {
synchronized ( deviceVersionsAvailableSet ) {
- return deviceVersionsAvailableSet.contains(getUniqueDeviceString(device));
+ return deviceVersionsAvailableSet.contains(device.getUniqueID());
}
}
protected static void setAvailableGLVersionsSet(AbstractGraphicsDevice device) {
synchronized ( deviceVersionsAvailableSet ) {
- String devKey = getUniqueDeviceString(device);
+ String devKey = device.getUniqueID();
if ( deviceVersionsAvailableSet.contains(devKey) ) {
throw new InternalError("Already set: "+devKey);
}
diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java
index 4111eb5a2..878c4024e 100644
--- a/src/jogl/classes/javax/media/opengl/GLProfile.java
+++ b/src/jogl/classes/javax/media/opengl/GLProfile.java
@@ -1476,7 +1476,7 @@ public class GLProfile {
if(null==device) {
device = defaultDevice;
}
- String deviceKey = GLContext.getUniqueDeviceString(device);
+ String deviceKey = device.getUniqueID();
HashMap map = (HashMap) deviceConn2ProfileMap.get(deviceKey);
if(null==map) {
map = new HashMap();
@@ -1491,7 +1491,7 @@ public class GLProfile {
private static void setProfileMap(AbstractGraphicsDevice device, HashMap/*<GL-String, GLProfile>*/mappedProfiles) {
validateInitialization();
synchronized ( deviceConn2ProfileMap ) {
- deviceConn2ProfileMap.put(GLContext.getUniqueDeviceString(device), mappedProfiles);
+ deviceConn2ProfileMap.put(device.getUniqueID(), mappedProfiles);
}
}
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index c0f2736fb..292bfba7c 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -779,7 +779,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable {
return null;
}
- AbstractGraphicsScreen aScreen = AWTGraphicsScreen.createScreenDevice(device);
+ AbstractGraphicsScreen aScreen = AWTGraphicsScreen.createScreenDevice(device, AbstractGraphicsDevice.DEFAULT_UNIT);
AWTGraphicsConfiguration config = (AWTGraphicsConfiguration)
GraphicsConfigurationFactory.getFactory(AWTGraphicsDevice.class).chooseGraphicsConfiguration(capabilities,
chooser,
diff --git a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
index c6911bac8..83b437612 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
@@ -51,6 +51,9 @@ public interface AbstractGraphicsDevice extends Cloneable {
/** Dummy connection value for an external connection where no native support for multiple devices is available */
public static String EXTERNAL_CONNECTION = "excon";
+ /** Default unit id for the 1st device: 0 */
+ public static int DEFAULT_UNIT = 0;
+
/**
* Returns the type of the underlying subsystem, ie
* NativeWindowFactory.TYPE_KD, NativeWindowFactory.TYPE_X11, ..
@@ -59,14 +62,36 @@ public interface AbstractGraphicsDevice extends Cloneable {
/**
* Returns the semantic GraphicsDevice connection.<br>
- * On platforms supporting multiple devices, local or network,
- * the implementation shall return a unique name.<br>
- * On X11 for example, the <code>DISPLAY</code> connection string,
- * eg. <code>:0.0</code>, could be returned.<br>
+ * On platforms supporting remote devices, eg via tcp/ip network,
+ * the implementation shall return a unique name for each remote address.<br>
+ * On X11 for example, the connection string should be as the following example.<br>
+ * <ul>
+ * <li><code>:0.0</code> for a local connection</li>
+ * <li><code>remote.host.net:0.0</code> for a remote connection</li>
+ * </ul>
+ *
+ * To support multiple local device, see {@link #getUnitID()}.
*/
public String getConnection();
/**
+ * Returns the graphics device <code>unit ID</code>.<br>
+ * The <code>unit ID</code> support multiple graphics device configurations
+ * on a local machine.<br>
+ * To support remote device, see {@link #getConnection()}.
+ * @return
+ */
+ public int getUnitID();
+
+ /**
+ * Returns a unique ID String of this device using {@link #getType() type},
+ * {@link #getConnection() connection} and {@link #getUnitID() unitID}.<br>
+ * The unique ID does not reflect the instance of the device, hence the handle is not included.<br>
+ * The unique ID may be used as a key for semantic device mapping.
+ */
+ public String getUniqueID();
+
+ /**
* Returns the native handle of the underlying native device,
* if such thing exist.
*/
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
index f28d254ab..cb367f939 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
@@ -36,8 +36,11 @@ package javax.media.nativewindow;
import com.jogamp.nativewindow.impl.NativeWindowFactoryImpl;
public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice {
+ private static final String separator = "_";
private String type;
protected String connection;
+ protected int unitID;
+ protected String uniqueID;
protected long handle;
protected ToolkitLock toolkitLock;
@@ -46,9 +49,11 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
* gathered via {@link NativeWindowFactory#createDefaultToolkitLock()}.
* @param type
*/
- public DefaultGraphicsDevice(String type, String connection) {
+ public DefaultGraphicsDevice(String type, String connection, int unitID) {
this.type = type;
this.connection = connection;
+ this.unitID = unitID;
+ this.uniqueID = getUniqueID(type, connection, unitID);
this.handle = 0;
setToolkitLock( NativeWindowFactory.getDefaultToolkitLock(type) );
}
@@ -59,9 +64,11 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
* @param type
* @param handle
*/
- public DefaultGraphicsDevice(String type, String connection, long handle) {
+ public DefaultGraphicsDevice(String type, String connection, int unitID, long handle) {
this.type = type;
this.connection = connection;
+ this.unitID = unitID;
+ this.uniqueID = getUniqueID(type, connection, unitID);
this.handle = handle;
setToolkitLock( NativeWindowFactory.createDefaultToolkitLock(type, handle) );
}
@@ -72,9 +79,11 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
* @param handle
* @param locker
*/
- public DefaultGraphicsDevice(String type, String connection, long handle, ToolkitLock locker) {
+ public DefaultGraphicsDevice(String type, String connection, int unitID, long handle, ToolkitLock locker) {
this.type = type;
this.connection = connection;
+ this.unitID = unitID;
+ this.uniqueID = getUniqueID(type, connection, unitID);
this.handle = handle;
setToolkitLock( locker );
}
@@ -95,6 +104,14 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
return connection;
}
+ public final int getUnitID() {
+ return unitID;
+ }
+
+ public final String getUniqueID() {
+ return uniqueID;
+ }
+
public final long getHandle() {
return handle;
}
@@ -126,7 +143,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
}
public String toString() {
- return getClass().toString()+"[type "+getType()+", connection "+getConnection()+", handle 0x"+Long.toHexString(getHandle())+"]";
+ return getClass().toString()+"[type "+getType()+", connection "+getConnection()+", unitID "+getUnitID()+", handle 0x"+Long.toHexString(getHandle())+"]";
}
/**
@@ -148,4 +165,8 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
public final ToolkitLock getToolkitLock() {
return toolkitLock;
}
+
+ protected static String getUniqueID(String type, String connection, int unitID) {
+ return (type + separator + connection + separator + unitID).intern();
+ }
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java
index 893b0ddd2..065385ae3 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java
@@ -41,12 +41,8 @@ public class DefaultGraphicsScreen implements Cloneable, AbstractGraphicsScreen
this.idx = idx;
}
- public static AbstractGraphicsScreen createScreenDevice(String connection,int screenIdx) {
- return new DefaultGraphicsScreen(new DefaultGraphicsDevice(NativeWindowFactory.TYPE_DEFAULT, connection), screenIdx);
- }
-
- public static AbstractGraphicsScreen createDefault() {
- return createScreenDevice(AbstractGraphicsDevice.DEFAULT_CONNECTION, 0);
+ public static AbstractGraphicsScreen createDefault(String type) {
+ return new DefaultGraphicsScreen(new DefaultGraphicsDevice(type, AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT), 0);
}
public Object clone() {
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
index 49b398b6f..a36440873 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
@@ -245,6 +245,18 @@ public abstract class NativeWindowFactory {
return useCustom?nativeWindowingTypeCustom:nativeWindowingTypePure;
}
+ /** Don't know if we shall add this factory here ..
+ public static AbstractGraphicsDevice createGraphicsDevice(String type, String connection, int unitID, long handle, ToolkitLock locker) {
+ if(type.equals(TYPE_EGL)) {
+ return new
+ } else if(type.equals(TYPE_X11)) {
+ } else if(type.equals(TYPE_WINDOWS)) {
+ } else if(type.equals(TYPE_MACOSX)) {
+ } else if(type.equals(TYPE_AWT)) {
+ } else if(type.equals(TYPE_DEFAULT)) {
+ }
+ } */
+
/** Sets the default NativeWindowFactory. */
public static void setDefaultFactory(NativeWindowFactory factory) {
defaultFactory = factory;
diff --git a/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsConfiguration.java b/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsConfiguration.java
index f56248e67..6aafc8549 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsConfiguration.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsConfiguration.java
@@ -84,13 +84,13 @@ public class AWTGraphicsConfiguration extends DefaultGraphicsConfiguration imple
awtGraphicsDevice = awtGfxConfig.getDevice();
if(null!=awtGraphicsDevice) {
// Create Device/Screen
- awtDevice = new AWTGraphicsDevice(awtGraphicsDevice);
+ awtDevice = new AWTGraphicsDevice(awtGraphicsDevice, AbstractGraphicsDevice.DEFAULT_UNIT);
awtScreen = new AWTGraphicsScreen(awtDevice);
}
}
if(null==awtScreen) {
// use defaults since no native peer is available yet
- awtScreen = (AWTGraphicsScreen) AWTGraphicsScreen.createScreenDevice(-1);
+ awtScreen = (AWTGraphicsScreen) AWTGraphicsScreen.createScreenDevice(-1, AbstractGraphicsDevice.DEFAULT_UNIT);
awtDevice = (AWTGraphicsDevice) awtScreen.getDevice();
awtGraphicsDevice = awtDevice.getGraphicsDevice();
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsDevice.java
index e1d7c84f1..cc4cd464f 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsDevice.java
@@ -51,17 +51,18 @@ public class AWTGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
private GraphicsDevice device;
private String subType;
- protected AWTGraphicsDevice(GraphicsDevice device) {
- super(NativeWindowFactory.TYPE_AWT, device.getIDstring());
+ protected AWTGraphicsDevice(GraphicsDevice device, int unitID) {
+ super(NativeWindowFactory.TYPE_AWT, device.getIDstring(), unitID);
this.device = device;
this.subType = null;
}
- public static AbstractGraphicsDevice createDevice(GraphicsDevice awtDevice) {
+ public static AbstractGraphicsDevice createDevice(GraphicsDevice awtDevice, int unitID) {
if(null==awtDevice) {
awtDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
+ unitID = AbstractGraphicsDevice.DEFAULT_UNIT;
}
- return new AWTGraphicsDevice(awtDevice);
+ return new AWTGraphicsDevice(awtDevice, unitID);
}
public Object clone() {
@@ -90,7 +91,7 @@ public class AWTGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
}
public String toString() {
- return getClass().toString()+"[type "+getType()+"[subType "+getSubType()+"], connection "+getConnection()+", awtDevice "+device+", handle 0x"+Long.toHexString(getHandle())+"]";
+ return getClass().toString()+"[type "+getType()+"[subType "+getSubType()+"], connection "+getConnection()+", unitID "+getUnitID()+", awtDevice "+device+", handle 0x"+Long.toHexString(getHandle())+"]";
}
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsScreen.java b/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsScreen.java
index 6cbf2ee71..383dcae80 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsScreen.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsScreen.java
@@ -43,7 +43,6 @@ import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import javax.media.nativewindow.*;
import javax.media.nativewindow.AbstractGraphicsDevice;
-import com.jogamp.nativewindow.impl.*;
/** A wrapper for an AWT GraphicsDevice (screen) allowing it to be
handled in a toolkit-independent manner. */
@@ -74,18 +73,18 @@ public class AWTGraphicsScreen extends DefaultGraphicsScreen implements Cloneabl
return -1;
}
- public static AbstractGraphicsScreen createScreenDevice(GraphicsDevice awtDevice) {
- AWTGraphicsDevice device = (AWTGraphicsDevice) AWTGraphicsDevice.createDevice(awtDevice);
+ public static AbstractGraphicsScreen createScreenDevice(GraphicsDevice awtDevice, int unitID) {
+ AWTGraphicsDevice device = (AWTGraphicsDevice) AWTGraphicsDevice.createDevice(awtDevice, unitID);
return new AWTGraphicsScreen(device);
}
- public static AbstractGraphicsScreen createScreenDevice(int index) {
+ public static AbstractGraphicsScreen createScreenDevice(int index, int unitID) {
GraphicsDevice awtDevice = getScreenDevice(index);
- return createScreenDevice(awtDevice);
+ return createScreenDevice(awtDevice, unitID);
}
public static AbstractGraphicsScreen createDefault() {
- return createScreenDevice(-1);
+ return createScreenDevice(-1, AbstractGraphicsDevice.DEFAULT_UNIT);
}
public Object clone() {
diff --git a/src/nativewindow/classes/javax/media/nativewindow/egl/EGLGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/egl/EGLGraphicsDevice.java
index 2fca915a0..7bd27fdba 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/egl/EGLGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/egl/EGLGraphicsDevice.java
@@ -40,18 +40,15 @@ import javax.media.nativewindow.*;
public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneable {
/**
* Note that this is not an open connection, ie no native display handle exist.
- * This constructor exist to setup a default device connection.<br>
- * FIXME:<br>
- * find out the EGL semantics of a device connection {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection()}
- * to actually use multiple devices.
+ * This constructor exist to setup a default device connection/unit.<br>
*/
- public EGLGraphicsDevice(String connection) {
- super(NativeWindowFactory.TYPE_EGL, connection);
+ public EGLGraphicsDevice(int unitID) {
+ super(NativeWindowFactory.TYPE_EGL, AbstractGraphicsDevice.DEFAULT_CONNECTION, unitID);
}
/** Constructs a new EGLGraphicsDevice corresponding to the given EGL display handle. */
- public EGLGraphicsDevice(long eglDisplay) {
- super(NativeWindowFactory.TYPE_EGL, AbstractGraphicsDevice.DEFAULT_CONNECTION, eglDisplay);
+ public EGLGraphicsDevice(long eglDisplay, int unitID) {
+ super(NativeWindowFactory.TYPE_EGL, AbstractGraphicsDevice.DEFAULT_CONNECTION, unitID, eglDisplay);
}
public Object clone() {
diff --git a/src/nativewindow/classes/javax/media/nativewindow/macosx/MacOSXGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/macosx/MacOSXGraphicsDevice.java
index b7dbf0d6a..02c63758f 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/macosx/MacOSXGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/macosx/MacOSXGraphicsDevice.java
@@ -38,20 +38,9 @@ import javax.media.nativewindow.*;
*/
public class MacOSXGraphicsDevice extends DefaultGraphicsDevice implements Cloneable {
- /**
- * Note that this is not an open connection, ie no native display handle exist.
- * This constructor exist to setup a default device connection.<br>
- * FIXME:<br>
- * find out the EGL semantics of a device connection {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection()}
- * to actually use multiple devices.
- */
- public MacOSXGraphicsDevice(String connection) {
- super(NativeWindowFactory.TYPE_MACOSX, connection);
- }
-
/** Constructs a new MacOSXGraphicsDevice */
- public MacOSXGraphicsDevice() {
- super(NativeWindowFactory.TYPE_MACOSX, AbstractGraphicsDevice.DEFAULT_CONNECTION);
+ public MacOSXGraphicsDevice(int unitID) {
+ super(NativeWindowFactory.TYPE_MACOSX, AbstractGraphicsDevice.DEFAULT_CONNECTION, unitID);
}
public Object clone() {
diff --git a/src/nativewindow/classes/javax/media/nativewindow/windows/WindowsGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/windows/WindowsGraphicsDevice.java
index fe11ba937..d5e32381b 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/windows/WindowsGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/windows/WindowsGraphicsDevice.java
@@ -38,20 +38,9 @@ import javax.media.nativewindow.*;
* Encapsulates a graphics device on Windows platforms.<br>
*/
public class WindowsGraphicsDevice extends DefaultGraphicsDevice implements Cloneable {
- /**
- * Note that this is not an open connection, ie no native display handle exist.
- * This constructor exist to setup a default device connection.<br>
- * FIXME:<br>
- * find out the Windows semantics of a device connection {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection()}
- * to actually use multiple devices.
- */
- public WindowsGraphicsDevice(String connection) {
- super(NativeWindowFactory.TYPE_WINDOWS, connection);
- }
-
/** Constructs a new WindowsGraphicsDevice */
- public WindowsGraphicsDevice() {
- super(NativeWindowFactory.TYPE_WINDOWS, AbstractGraphicsDevice.DEFAULT_CONNECTION);
+ public WindowsGraphicsDevice(int unitID) {
+ super(NativeWindowFactory.TYPE_WINDOWS, AbstractGraphicsDevice.DEFAULT_CONNECTION, unitID);
}
public Object clone() {
diff --git a/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsDevice.java
index dfbe8c6dd..31e03f8f1 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsDevice.java
@@ -46,15 +46,16 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
* Note that this is not an open connection, ie no native display handle exist.
* This constructor exist to setup a default device connection.
*/
- public X11GraphicsDevice(String connection) {
- super(NativeWindowFactory.TYPE_X11, connection);
+ public X11GraphicsDevice(String connection, int unitID) {
+ super(NativeWindowFactory.TYPE_X11, connection, unitID);
}
/** Constructs a new X11GraphicsDevice corresponding to the given native display handle and default
* {@link javax.media.nativewindow.ToolkitLock} via {@link NativeWindowFactory#createDefaultToolkitLock(java.lang.String, long)}.
*/
- public X11GraphicsDevice(long display) {
- super(NativeWindowFactory.TYPE_X11, X11Util.XDisplayString(display), display);
+ public X11GraphicsDevice(long display, int unitID) {
+ // FIXME: derive unitID from connection could be buggy, one DISPLAY for all screens for example..
+ super(NativeWindowFactory.TYPE_X11, X11Util.XDisplayString(display), unitID, display);
if(0==display) {
throw new NativeWindowException("null display");
}
@@ -64,8 +65,8 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
* @param display the Display connection
* @param locker custom {@link javax.media.nativewindow.ToolkitLock}, eg to force null locking in NEWT
*/
- public X11GraphicsDevice(long display, ToolkitLock locker) {
- super(NativeWindowFactory.TYPE_X11, X11Util.XDisplayString(display), display, locker);
+ public X11GraphicsDevice(long display, int unitID, ToolkitLock locker) {
+ super(NativeWindowFactory.TYPE_X11, X11Util.XDisplayString(display), unitID, display, locker);
if(0==display) {
throw new NativeWindowException("null display");
}
@@ -79,6 +80,7 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
closeDisplay = close;
}
public boolean close() {
+ // FIXME: shall we respect the unitID ?
if(closeDisplay && 0 != handle) {
X11Util.closeDisplay(handle);
handle = 0;
diff --git a/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java b/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java
index dca0d1de3..9de3baa51 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsScreen.java
@@ -50,7 +50,7 @@ public class X11GraphicsScreen extends DefaultGraphicsScreen implements Cloneabl
public static AbstractGraphicsScreen createScreenDevice(long display, int screenIdx) {
if(0==display) throw new NativeWindowException("display is null");
- return new X11GraphicsScreen(new X11GraphicsDevice(display), screenIdx);
+ return new X11GraphicsScreen(new X11GraphicsDevice(display, AbstractGraphicsDevice.DEFAULT_UNIT), screenIdx);
}
public long getDefaultVisualID() {
diff --git a/src/newt/classes/com/jogamp/newt/impl/awt/AWTCanvas.java b/src/newt/classes/com/jogamp/newt/impl/awt/AWTCanvas.java
index 9b0ec6907..4b30e10b6 100644
--- a/src/newt/classes/com/jogamp/newt/impl/awt/AWTCanvas.java
+++ b/src/newt/classes/com/jogamp/newt/impl/awt/AWTCanvas.java
@@ -227,7 +227,7 @@ public class AWTCanvas extends Canvas {
private static AWTGraphicsConfiguration chooseGraphicsConfiguration(Capabilities capabilities,
GraphicsDevice device) {
- AbstractGraphicsScreen aScreen = AWTGraphicsScreen.createScreenDevice(device);
+ AbstractGraphicsScreen aScreen = AWTGraphicsScreen.createScreenDevice(device, AbstractGraphicsDevice.DEFAULT_UNIT);
AWTGraphicsConfiguration config = (AWTGraphicsConfiguration)
GraphicsConfigurationFactory.getFactory(AWTGraphicsDevice.class).chooseGraphicsConfiguration(capabilities,
null,
diff --git a/src/newt/classes/com/jogamp/newt/impl/awt/AWTDisplay.java b/src/newt/classes/com/jogamp/newt/impl/awt/AWTDisplay.java
index 0199d6c72..6f0b23210 100644
--- a/src/newt/classes/com/jogamp/newt/impl/awt/AWTDisplay.java
+++ b/src/newt/classes/com/jogamp/newt/impl/awt/AWTDisplay.java
@@ -46,7 +46,7 @@ public class AWTDisplay extends DisplayImpl {
}
protected void createNativeImpl() {
- aDevice = (AWTGraphicsDevice) AWTGraphicsDevice.createDevice(null); // default
+ aDevice = (AWTGraphicsDevice) AWTGraphicsDevice.createDevice(null, AbstractGraphicsDevice.DEFAULT_UNIT); // default
}
protected void setAWTGraphicsDevice(AWTGraphicsDevice d) {
diff --git a/src/newt/classes/com/jogamp/newt/impl/intel/gdl/Display.java b/src/newt/classes/com/jogamp/newt/impl/intel/gdl/Display.java
index 5d40d3709..c08f239d9 100644
--- a/src/newt/classes/com/jogamp/newt/impl/intel/gdl/Display.java
+++ b/src/newt/classes/com/jogamp/newt/impl/intel/gdl/Display.java
@@ -68,7 +68,7 @@ public class Display extends com.jogamp.newt.impl.DisplayImpl {
}
initCounter++;
}
- aDevice = new DefaultGraphicsDevice(NativeWindowFactory.TYPE_DEFAULT, AbstractGraphicsDevice.DEFAULT_CONNECTION, displayHandle);
+ aDevice = new DefaultGraphicsDevice(NativeWindowFactory.TYPE_DEFAULT, AbstractGraphicsDevice.DEFAULT_CONNECTION, AbstractGraphicsDevice.DEFAULT_UNIT, displayHandle);
}
protected void closeNativeImpl() {
diff --git a/src/newt/classes/com/jogamp/newt/impl/macosx/MacDisplay.java b/src/newt/classes/com/jogamp/newt/impl/macosx/MacDisplay.java
index dc45f7479..cf9d4f0a3 100644
--- a/src/newt/classes/com/jogamp/newt/impl/macosx/MacDisplay.java
+++ b/src/newt/classes/com/jogamp/newt/impl/macosx/MacDisplay.java
@@ -68,7 +68,7 @@ public class MacDisplay extends DisplayImpl {
}
protected void createNativeImpl() {
- aDevice = new MacOSXGraphicsDevice();
+ aDevice = new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
}
protected void closeNativeImpl() { }
diff --git a/src/newt/classes/com/jogamp/newt/impl/opengl/broadcom/egl/Display.java b/src/newt/classes/com/jogamp/newt/impl/opengl/broadcom/egl/Display.java
index 18d058a9c..ba7fe3c66 100644
--- a/src/newt/classes/com/jogamp/newt/impl/opengl/broadcom/egl/Display.java
+++ b/src/newt/classes/com/jogamp/newt/impl/opengl/broadcom/egl/Display.java
@@ -61,7 +61,7 @@ public class Display extends com.jogamp.newt.impl.DisplayImpl {
if (handle == EGL.EGL_NO_DISPLAY) {
throw new NativeWindowException("BC EGL CreateDisplay failed");
}
- aDevice = new EGLGraphicsDevice(handle);
+ aDevice = new EGLGraphicsDevice(handle, AbstractGraphicsDevice.DEFAULT_UNIT);
}
protected void closeNativeImpl() {
diff --git a/src/newt/classes/com/jogamp/newt/impl/opengl/kd/KDDisplay.java b/src/newt/classes/com/jogamp/newt/impl/opengl/kd/KDDisplay.java
index eab1816da..8dc2dd9cc 100644
--- a/src/newt/classes/com/jogamp/newt/impl/opengl/kd/KDDisplay.java
+++ b/src/newt/classes/com/jogamp/newt/impl/opengl/kd/KDDisplay.java
@@ -66,7 +66,7 @@ public class KDDisplay extends DisplayImpl {
if (!EGL.eglInitialize(handle, null, null)) {
throw new NativeWindowException("eglInitialize failed");
}
- aDevice = new EGLGraphicsDevice(handle);
+ aDevice = new EGLGraphicsDevice(handle, AbstractGraphicsDevice.DEFAULT_UNIT);
}
protected void closeNativeImpl() {
diff --git a/src/newt/classes/com/jogamp/newt/impl/windows/WindowsDisplay.java b/src/newt/classes/com/jogamp/newt/impl/windows/WindowsDisplay.java
index fe86257ff..372859208 100644
--- a/src/newt/classes/com/jogamp/newt/impl/windows/WindowsDisplay.java
+++ b/src/newt/classes/com/jogamp/newt/impl/windows/WindowsDisplay.java
@@ -61,7 +61,7 @@ public class WindowsDisplay extends DisplayImpl {
}
protected void createNativeImpl() {
- aDevice = new WindowsGraphicsDevice();
+ aDevice = new WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT);
}
protected void closeNativeImpl() {
diff --git a/src/newt/classes/com/jogamp/newt/impl/x11/X11Display.java b/src/newt/classes/com/jogamp/newt/impl/x11/X11Display.java
index a24d0953e..ab1e271a4 100644
--- a/src/newt/classes/com/jogamp/newt/impl/x11/X11Display.java
+++ b/src/newt/classes/com/jogamp/newt/impl/x11/X11Display.java
@@ -75,7 +75,7 @@ public class X11Display extends DisplayImpl {
X11Util.closeDisplay(handle);
throw e;
}
- aDevice = new X11GraphicsDevice(handle, NativeWindowFactory.getNullToolkitLock());
+ aDevice = new X11GraphicsDevice(handle, AbstractGraphicsDevice.DEFAULT_UNIT, NativeWindowFactory.getNullToolkitLock());
// aDevice = new X11GraphicsDevice(handle, NativeWindowFactory.createDefaultToolkitLockNoAWT(NativeWindowFactory.TYPE_X11, handle));
// aDevice = new X11GraphicsDevice(handle);