Class EGLGraphicsDevice
- java.lang.Object
-
- com.jogamp.nativewindow.DefaultGraphicsDevice
-
- com.jogamp.nativewindow.egl.EGLGraphicsDevice
-
- All Implemented Interfaces:
AbstractGraphicsDevice
,Cloneable
public class EGLGraphicsDevice extends DefaultGraphicsDevice implements Cloneable
Encapsulates a graphics device on EGL platforms.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
EGLGraphicsDevice.EGLDisplayLifecycleCallback
Hack to allow inject a EGL termination call.
-
Field Summary
Fields Modifier and Type Field Description static int
EGL_DEFAULT_DISPLAY
EGL default native display IDstatic int
EGL_NO_DISPLAY
EGL no display handle-
Fields inherited from interface com.jogamp.nativewindow.AbstractGraphicsDevice
DEBUG, DEFAULT_CONNECTION, DEFAULT_UNIT, EXTERNAL_CONNECTION
-
-
Constructor Summary
Constructors Constructor Description EGLGraphicsDevice()
Constructs a dummyEGLGraphicsDevice
with default connection settings.EGLGraphicsDevice(long nativeDisplayID, long eglDisplay, String connection, int unitID)
Constructs a newEGLGraphicsDevice
reusing the given native display connection and handleEGLGraphicsDevice(long nativeDisplayID, String connection, int unitID)
Constructs a new dummyEGLGraphicsDevice
reusing the given native display connection with aEGL#EGL_NO_DISPLAY
EGL display handle.EGLGraphicsDevice(long nativeDisplayID, String connection, int unitID, EGLGraphicsDevice.EGLDisplayLifecycleCallback eglLifecycleCallback)
Constructs a newEGLGraphicsDevice
usingAbstractGraphicsDevice
's native display ID and connection, using theEGLGraphicsDevice.EGLDisplayLifecycleCallback
to handle this instance's native EGL lifecycle.EGLGraphicsDevice(AbstractGraphicsDevice aDevice, EGLGraphicsDevice.EGLDisplayLifecycleCallback eglLifecycleCallback)
Constructs a newEGLGraphicsDevice
usingAbstractGraphicsDevice
's native display ID and connection, using theEGLGraphicsDevice.EGLDisplayLifecycleCallback
to handle this instance's native EGL lifecycle.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearHandleOwner()
Object
clone()
boolean
close()
Closes the EGL device if handle is not null and it'sEGLGraphicsDevice.EGLDisplayLifecycleCallback
is valid.VersionNumber
getEGLVersion()
EGL server version as returned byeglInitialize(..)
.long
getNativeDisplayID()
Return the native display ID of this instance.static long
getNativeDisplayID(AbstractGraphicsDevice aDevice)
Returns the native display ID of the given abstract device, i.e.boolean
isHandleOwner()
boolean
open()
Opens the EGL device if handle is null and it'sEGLGraphicsDevice.EGLDisplayLifecycleCallback
is valid.boolean
sameNativeDisplayID(AbstractGraphicsDevice aDevice)
Returns true if givenAbstractGraphicsDevice
uses the samegetNativeDisplayID()
of this instance.String
toString()
-
Methods inherited from class com.jogamp.nativewindow.DefaultGraphicsDevice
getConnection, getDefaultDisplayConnection, getDefaultDisplayConnection, getHandle, getToolkitLock, getType, getUniqueID, getUnitID, lock, swapDeviceHandleAndOwnership, unlock, validateLocked
-
-
-
-
Field Detail
-
EGL_DEFAULT_DISPLAY
public static final int EGL_DEFAULT_DISPLAY
EGL default native display ID- See Also:
- Constant Field Values
-
EGL_NO_DISPLAY
public static final int EGL_NO_DISPLAY
EGL no display handle- See Also:
- Constant Field Values
-
-
Constructor Detail
-
EGLGraphicsDevice
public EGLGraphicsDevice()
Constructs a dummyEGLGraphicsDevice
with default connection settings.The constructed instance will never create a valid EGL display handle.
-
EGLGraphicsDevice
public EGLGraphicsDevice(long nativeDisplayID, String connection, int unitID)
Constructs a new dummyEGLGraphicsDevice
reusing the given native display connection with aEGL#EGL_NO_DISPLAY
EGL display handle.The constructed instance will never create a valid EGL display handle.
- Parameters:
nativeDisplayID
- the existing native display IDeglDisplay
- the existing EGL handle to this nativeDisplayIDconnection
- the existing underlying native connection nameunitID
- the unit ID
-
EGLGraphicsDevice
public EGLGraphicsDevice(long nativeDisplayID, long eglDisplay, String connection, int unitID)
Constructs a newEGLGraphicsDevice
reusing the given native display connection and handleThe constructed instance will not take ownership of given EGL display handle.
- Parameters:
nativeDisplayID
- the existing native display IDeglDisplay
- the existing EGL handle to this nativeDisplayIDconnection
- the existing underlying native connection nameunitID
- the unit ID
-
EGLGraphicsDevice
public EGLGraphicsDevice(AbstractGraphicsDevice aDevice, EGLGraphicsDevice.EGLDisplayLifecycleCallback eglLifecycleCallback)
Constructs a newEGLGraphicsDevice
usingAbstractGraphicsDevice
's native display ID and connection, using theEGLGraphicsDevice.EGLDisplayLifecycleCallback
to handle this instance's native EGL lifecycle.The constructed instance will take ownership of the created EGL display handle.
- Parameters:
aDevice
- validAbstractGraphicsDevice
's native display ID, connection and unitIDeglLifecycleCallback
- validEGLGraphicsDevice.EGLDisplayLifecycleCallback
to handle this instance's native EGL lifecycle.
-
EGLGraphicsDevice
public EGLGraphicsDevice(long nativeDisplayID, String connection, int unitID, EGLGraphicsDevice.EGLDisplayLifecycleCallback eglLifecycleCallback)
Constructs a newEGLGraphicsDevice
usingAbstractGraphicsDevice
's native display ID and connection, using theEGLGraphicsDevice.EGLDisplayLifecycleCallback
to handle this instance's native EGL lifecycle.The constructed instance will take ownership of the created EGL display handle.
- Parameters:
nativeDisplayID
- the existing native display IDconnection
- the existing underlying native connection nameunitID
- the unit IDeglLifecycleCallback
- validEGLGraphicsDevice.EGLDisplayLifecycleCallback
to handle this instance's native EGL lifecycle.
-
-
Method Detail
-
getNativeDisplayID
public static long getNativeDisplayID(AbstractGraphicsDevice aDevice)
Returns the native display ID of the given abstract device, i.e. eithergetNativeDisplayID()
orAbstractGraphicsDevice.getHandle()
.
-
getEGLVersion
public VersionNumber getEGLVersion()
EGL server version as returned byeglInitialize(..)
. Only valid afteropen()
.
-
getNativeDisplayID
public long getNativeDisplayID()
Return the native display ID of this instance.Since EGL 1.4, sharing resources requires e.g. a GLContext to use the same native display ID for the so called shared context list and the to be created context.
-
sameNativeDisplayID
public boolean sameNativeDisplayID(AbstractGraphicsDevice aDevice)
Returns true if givenAbstractGraphicsDevice
uses the samegetNativeDisplayID()
of this instance.In case given
AbstractGraphicsDevice
is not aEGLGraphicsDevice
, itsAbstractGraphicsDevice.getHandle()
is being used as the native display id for a matchingEGLGraphicsDevice
instance.
-
clone
public Object clone()
- Specified by:
clone
in interfaceAbstractGraphicsDevice
- Overrides:
clone
in classDefaultGraphicsDevice
-
open
public boolean open()
Opens the EGL device if handle is null and it'sEGLGraphicsDevice.EGLDisplayLifecycleCallback
is valid.Optionally [re]opening the device if handle is
null
.The default implementation is a
NOP
.Example implementations like
X11GraphicsDevice
orEGLGraphicsDevice
issue the native open operation in case handle isnull
.- Specified by:
open
in interfaceAbstractGraphicsDevice
- Overrides:
open
in classDefaultGraphicsDevice
- Returns:
- true if the handle was
null
and opening was successful, otherwise false.
-
close
public boolean close()
Closes the EGL device if handle is not null and it'sEGLGraphicsDevice.EGLDisplayLifecycleCallback
is valid.Optionally closing the device if handle is not
null
.The default implementation
dispose
it'sToolkitLock
and sets the handle tonull
.Example implementations like
X11GraphicsDevice
orEGLGraphicsDevice
issue the native close operation or skip it depending on thehandles's ownership
.- Specified by:
close
in interfaceAbstractGraphicsDevice
- Overrides:
close
in classDefaultGraphicsDevice
- Returns:
- true if the handle was not
null
and closing was successful, otherwise false.
-
isHandleOwner
public boolean isHandleOwner()
- Specified by:
isHandleOwner
in interfaceAbstractGraphicsDevice
- Overrides:
isHandleOwner
in classDefaultGraphicsDevice
- Returns:
true
if instance owns the handle to issueAbstractGraphicsDevice.close()
, otherwisefalse
.
-
clearHandleOwner
public void clearHandleOwner()
- Specified by:
clearHandleOwner
in interfaceAbstractGraphicsDevice
- Overrides:
clearHandleOwner
in classDefaultGraphicsDevice
-
toString
public String toString()
- Overrides:
toString
in classDefaultGraphicsDevice
-
-