aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-11-12 03:29:06 +0100
committerSven Gothel <[email protected]>2010-11-12 03:29:06 +0100
commitc2e805f5cf9c209cfbd1a3082a347d9f3d58c9d5 (patch)
tree7703bcc98e321ae793d6f2d95aa2970358cd58fa /src
parent0893339854e3f4a4fab7b19e073304973e763b10 (diff)
AbstractGraphicsDevice ..: Add device/display connection attribute to support multi devices & displays.
Currently only the X11 Display connection is implemented to support multiple device connections. Other platforms may follow. This allows correct mapping and caching of higher level resources, eg. ProcAddressTable, GL version mapping etc with respect to the display device.
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java5
-rw-r--r--src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java4
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java15
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java20
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java6
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsDevice.java4
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/egl/EGLGraphicsDevice.java2
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/macosx/MacOSXGraphicsDevice.java2
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/windows/WindowsGraphicsDevice.java2
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsDevice.java4
-rw-r--r--src/newt/classes/com/jogamp/newt/impl/intel/gdl/Display.java2
11 files changed, 42 insertions, 24 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java
index e3ca4fa54..153680f8e 100644
--- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java
+++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java
@@ -29,12 +29,7 @@
package com.jogamp.opengl.impl.windows.wgl;
import com.jogamp.opengl.impl.*;
-import com.jogamp.common.os.DynamicLookupHelper;
-import com.jogamp.common.os.NativeLibrary;
-import com.jogamp.common.os.Platform;
import java.util.*;
-import java.security.*;
-import javax.media.opengl.GLException;
public class WindowsWGLDynamicLibraryBundleInfo extends DesktopGLDynamicLibraryBundleInfo {
protected WindowsWGLDynamicLibraryBundleInfo() {
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 c8ecb2b72..317751725 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(0);
+ absScreen = DefaultGraphicsScreen.createScreenDevice(AbstractGraphicsDevice.DEFAULT_CONNECTION, 0);
}
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(0);
+ absScreen = DefaultGraphicsScreen.createScreenDevice(AbstractGraphicsDevice.DEFAULT_CONNECTION, 0);
}
GLCapabilities caps2 = (GLCapabilities) caps.clone();
if(!caps2.isOnscreen()) {
diff --git a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
index 581df5163..c6911bac8 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/AbstractGraphicsDevice.java
@@ -45,6 +45,12 @@ package javax.media.nativewindow;
*/
public interface AbstractGraphicsDevice extends Cloneable {
+ /** Dummy connection value for a default connection where no native support for multiple devices is available */
+ public static String DEFAULT_CONNECTION = "decon";
+
+ /** Dummy connection value for an external connection where no native support for multiple devices is available */
+ public static String EXTERNAL_CONNECTION = "excon";
+
/**
* Returns the type of the underlying subsystem, ie
* NativeWindowFactory.TYPE_KD, NativeWindowFactory.TYPE_X11, ..
@@ -52,6 +58,15 @@ public interface AbstractGraphicsDevice extends Cloneable {
public String getType();
/**
+ * 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>
+ */
+ public String getConnection();
+
+ /**
* 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 4e91eb2a7..f28d254ab 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsDevice.java
@@ -37,6 +37,7 @@ import com.jogamp.nativewindow.impl.NativeWindowFactoryImpl;
public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice {
private String type;
+ protected String connection;
protected long handle;
protected ToolkitLock toolkitLock;
@@ -45,8 +46,9 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
* gathered via {@link NativeWindowFactory#createDefaultToolkitLock()}.
* @param type
*/
- public DefaultGraphicsDevice(String type) {
+ public DefaultGraphicsDevice(String type, String connection) {
this.type = type;
+ this.connection = connection;
this.handle = 0;
setToolkitLock( NativeWindowFactory.getDefaultToolkitLock(type) );
}
@@ -57,8 +59,9 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
* @param type
* @param handle
*/
- public DefaultGraphicsDevice(String type, long handle) {
+ public DefaultGraphicsDevice(String type, String connection, long handle) {
this.type = type;
+ this.connection = connection;
this.handle = handle;
setToolkitLock( NativeWindowFactory.createDefaultToolkitLock(type, handle) );
}
@@ -69,8 +72,9 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
* @param handle
* @param locker
*/
- public DefaultGraphicsDevice(String type, long handle, ToolkitLock locker) {
+ public DefaultGraphicsDevice(String type, String connection, long handle, ToolkitLock locker) {
this.type = type;
+ this.connection = connection;
this.handle = handle;
setToolkitLock( locker );
}
@@ -83,11 +87,15 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
}
}
- public String getType() {
+ public final String getType() {
return type;
}
- public long getHandle() {
+ public final String getConnection() {
+ return connection;
+ }
+
+ public final long getHandle() {
return handle;
}
@@ -118,7 +126,7 @@ public class DefaultGraphicsDevice implements Cloneable, AbstractGraphicsDevice
}
public String toString() {
- return getClass().toString()+"[type "+getType()+", handle 0x"+Long.toHexString(getHandle())+"]";
+ return getClass().toString()+"[type "+getType()+", connection "+getConnection()+", handle 0x"+Long.toHexString(getHandle())+"]";
}
/**
diff --git a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java
index 0af32c9ec..893b0ddd2 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/DefaultGraphicsScreen.java
@@ -41,12 +41,12 @@ public class DefaultGraphicsScreen implements Cloneable, AbstractGraphicsScreen
this.idx = idx;
}
- public static AbstractGraphicsScreen createScreenDevice(int screenIdx) {
- return new DefaultGraphicsScreen(new DefaultGraphicsDevice(NativeWindowFactory.TYPE_DEFAULT), screenIdx);
+ public static AbstractGraphicsScreen createScreenDevice(String connection,int screenIdx) {
+ return new DefaultGraphicsScreen(new DefaultGraphicsDevice(NativeWindowFactory.TYPE_DEFAULT, connection), screenIdx);
}
public static AbstractGraphicsScreen createDefault() {
- return createScreenDevice(0);
+ return createScreenDevice(AbstractGraphicsDevice.DEFAULT_CONNECTION, 0);
}
public Object clone() {
diff --git a/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsDevice.java
index e91261211..e1d7c84f1 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/awt/AWTGraphicsDevice.java
@@ -52,7 +52,7 @@ public class AWTGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
private String subType;
protected AWTGraphicsDevice(GraphicsDevice device) {
- super(NativeWindowFactory.TYPE_AWT);
+ super(NativeWindowFactory.TYPE_AWT, device.getIDstring());
this.device = device;
this.subType = null;
}
@@ -90,7 +90,7 @@ public class AWTGraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
}
public String toString() {
- return getClass().toString()+"[type "+getType()+"[subType "+getSubType()+"], awtDevice "+device+", handle 0x"+Long.toHexString(getHandle())+"]";
+ return getClass().toString()+"[type "+getType()+"[subType "+getSubType()+"], connection "+getConnection()+", awtDevice "+device+", handle 0x"+Long.toHexString(getHandle())+"]";
}
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/egl/EGLGraphicsDevice.java b/src/nativewindow/classes/javax/media/nativewindow/egl/EGLGraphicsDevice.java
index 49c337359..609003290 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/egl/EGLGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/egl/EGLGraphicsDevice.java
@@ -40,7 +40,7 @@ import javax.media.nativewindow.*;
public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneable {
/** Constructs a new EGLGraphicsDevice corresponding to the given EGL display handle. */
public EGLGraphicsDevice(long eglDisplay) {
- super(NativeWindowFactory.TYPE_EGL, eglDisplay);
+ super(NativeWindowFactory.TYPE_EGL, AbstractGraphicsDevice.DEFAULT_CONNECTION, 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 3669ebd12..82b87eb29 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/macosx/MacOSXGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/macosx/MacOSXGraphicsDevice.java
@@ -40,7 +40,7 @@ import javax.media.nativewindow.*;
public class MacOSXGraphicsDevice extends DefaultGraphicsDevice implements Cloneable {
/** Constructs a new MacOSXGraphicsDevice */
public MacOSXGraphicsDevice() {
- super(NativeWindowFactory.TYPE_MACOSX);
+ super(NativeWindowFactory.TYPE_MACOSX, AbstractGraphicsDevice.DEFAULT_CONNECTION);
}
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 69dde49af..666fc6196 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/windows/WindowsGraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/windows/WindowsGraphicsDevice.java
@@ -40,7 +40,7 @@ import javax.media.nativewindow.*;
public class WindowsGraphicsDevice extends DefaultGraphicsDevice implements Cloneable {
/** Constructs a new WindowsGraphicsDevice */
public WindowsGraphicsDevice() {
- super(NativeWindowFactory.TYPE_WINDOWS);
+ super(NativeWindowFactory.TYPE_WINDOWS, AbstractGraphicsDevice.DEFAULT_CONNECTION);
}
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 c60597661..a8e11efba 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsDevice.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/x11/X11GraphicsDevice.java
@@ -45,7 +45,7 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
* {@link javax.media.nativewindow.ToolkitLock} via {@link NativeWindowFactory#createDefaultToolkitLock(java.lang.String, long)}.
*/
public X11GraphicsDevice(long display) {
- super(NativeWindowFactory.TYPE_X11, display);
+ super(NativeWindowFactory.TYPE_X11, X11Util.XDisplayString(display), display);
if(0==display) {
throw new NativeWindowException("null display");
}
@@ -56,7 +56,7 @@ public class X11GraphicsDevice extends DefaultGraphicsDevice implements Cloneabl
* @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, display, locker);
+ super(NativeWindowFactory.TYPE_X11, X11Util.XDisplayString(display), display, locker);
if(0==display) {
throw new NativeWindowException("null display");
}
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 0bd4c3b5d..5d40d3709 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, displayHandle);
+ aDevice = new DefaultGraphicsDevice(NativeWindowFactory.TYPE_DEFAULT, AbstractGraphicsDevice.DEFAULT_CONNECTION, displayHandle);
}
protected void closeNativeImpl() {