Package com.jogamp.nativewindow
Interface AbstractGraphicsDevice
- All Superinterfaces:
Cloneable
- All Known Implementing Classes:
AWTGraphicsDevice,DefaultGraphicsDevice,EGLGraphicsDevice,MacOSXGraphicsDevice,WindowsGraphicsDevice,X11GraphicsDevice
A interface describing a graphics device in a
toolkit-independent manner.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanstatic final StringDummy connection value for a default connection where no native support for multiple devices is availablestatic final intDefault unit id for the 1st device: 0static final StringDummy connection value for an external connection where no native support for multiple devices is available -
Method Summary
Modifier and TypeMethodDescriptionvoidclone()booleanclose()Optionally closing the device if handle is notnull.Returns the semantic GraphicsDevice connection.
On platforms supporting remote devices, eg via tcp/ip network, the implementation shall return a unique name for each remote address.
On X11 for example, the connection string should be as the following example.
:0.0for a local connectionremote.host.net:0.0for a remote connection To support multiple local device, seegetUnitID().longReturns the native handle of the underlying native device, if such thing exist.getType()Returns the type of the underlying subsystem, ie NativeWindowFactory.TYPE_KD, NativeWindowFactory.TYPE_X11, ..intReturns the graphics deviceunit ID.
Theunit IDsupport multiple graphics device configurations on a local machine.
To support remote device, seegetConnection().booleanvoidlock()Optionally locking the device, utilizing egToolkitLock.lock().booleanopen()Optionally [re]opening the device if handle isnull.voidunlock()Optionally unlocking the device, utilizing egToolkitLock.unlock().void
-
Field Details
-
DEBUG
static final boolean DEBUG -
DEFAULT_CONNECTION
Dummy connection value for a default connection where no native support for multiple devices is available- See Also:
-
EXTERNAL_CONNECTION
Dummy connection value for an external connection where no native support for multiple devices is available- See Also:
-
DEFAULT_UNIT
static final int DEFAULT_UNITDefault unit id for the 1st device: 0- See Also:
-
-
Method Details
-
clone
Object clone() -
getType
String getType()Returns the type of the underlying subsystem, ie NativeWindowFactory.TYPE_KD, NativeWindowFactory.TYPE_X11, .. -
getConnection
String getConnection()Returns the semantic GraphicsDevice connection.
On platforms supporting remote devices, eg via tcp/ip network, the implementation shall return a unique name for each remote address.
On X11 for example, the connection string should be as the following example.
:0.0for a local connectionremote.host.net:0.0for a remote connection
getUnitID(). -
getUnitID
int getUnitID()Returns the graphics deviceunit ID.
Theunit IDsupport multiple graphics device configurations on a local machine.
To support remote device, seegetConnection().- Returns:
-
getUniqueID
String getUniqueID()Returns a unique ID object of this device usingtype,connectionandunitIDas it's key components.The unique ID does not reflect the instance of the device, hence the handle is not included. The unique ID may be used as a key for semantic device mapping.
The returned string object reference is unique using
String.intern()and hence can be used as a key itself. -
getHandle
long getHandle()Returns the native handle of the underlying native device, if such thing exist. -
lock
void lock()Optionally locking the device, utilizing egToolkitLock.lock(). The lock implementation must be recursive. -
unlock
void unlock()Optionally unlocking the device, utilizing egToolkitLock.unlock(). The lock implementation must be recursive.- Throws:
RuntimeException- in case the lock is not acquired by this thread.
-
validateLocked
- Throws:
RuntimeException- if current thread does not hold the lock
-
open
boolean open()Optionally [re]opening the device if handle isnull.The default implementation is a
NOP.Example implementations like
X11GraphicsDeviceorEGLGraphicsDeviceissue the native open operation in case handle isnull.- Returns:
- true if the handle was
nulland opening was successful, otherwise false.
-
close
boolean close()Optionally closing the device if handle is notnull.The default implementation
disposeit'sToolkitLockand sets the handle tonull.Example implementations like
X11GraphicsDeviceorEGLGraphicsDeviceissue the native close operation or skip it depending on thehandles's ownership.- Returns:
- true if the handle was not
nulland closing was successful, otherwise false.
-
isHandleOwner
boolean isHandleOwner()- Returns:
trueif instance owns the handle to issueclose(), otherwisefalse.
-
clearHandleOwner
void clearHandleOwner()
-