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 interfaceEGLGraphicsDevice.EGLDisplayLifecycleCallbackHack to allow inject a EGL termination call.
-
Field Summary
Fields Modifier and Type Field Description static intEGL_DEFAULT_DISPLAYEGL default native display IDstatic intEGL_NO_DISPLAYEGL 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 dummyEGLGraphicsDevicewith default connection settings.EGLGraphicsDevice(long nativeDisplayID, long eglDisplay, String connection, int unitID)Constructs a newEGLGraphicsDevicereusing the given native display connection and handleEGLGraphicsDevice(long nativeDisplayID, String connection, int unitID)Constructs a new dummyEGLGraphicsDevicereusing the given native display connection with aEGL#EGL_NO_DISPLAYEGL display handle.EGLGraphicsDevice(long nativeDisplayID, String connection, int unitID, EGLGraphicsDevice.EGLDisplayLifecycleCallback eglLifecycleCallback)Constructs a newEGLGraphicsDeviceusingAbstractGraphicsDevice's native display ID and connection, using theEGLGraphicsDevice.EGLDisplayLifecycleCallbackto handle this instance's native EGL lifecycle.EGLGraphicsDevice(AbstractGraphicsDevice aDevice, EGLGraphicsDevice.EGLDisplayLifecycleCallback eglLifecycleCallback)Constructs a newEGLGraphicsDeviceusingAbstractGraphicsDevice's native display ID and connection, using theEGLGraphicsDevice.EGLDisplayLifecycleCallbackto handle this instance's native EGL lifecycle.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectclone()booleanclose()Closes the EGL device if handle is not null and it'sEGLGraphicsDevice.EGLDisplayLifecycleCallbackis valid.VersionNumbergetEGLVersion()EGL server version as returned byeglInitialize(..).longgetNativeDisplayID()Return the native display ID of this instance.static longgetNativeDisplayID(AbstractGraphicsDevice aDevice)Returns the native display ID of the given abstract device, i.e.booleanopen()Opens the EGL device if handle is null and it'sEGLGraphicsDevice.EGLDisplayLifecycleCallbackis valid.booleansameNativeDisplayID(AbstractGraphicsDevice aDevice)Returns true if givenAbstractGraphicsDeviceuses the samegetNativeDisplayID()of this instance.StringtoString()-
Methods inherited from class com.jogamp.nativewindow.DefaultGraphicsDevice
clearHandleOwner, getConnection, getDefaultDisplayConnection, getDefaultDisplayConnection, getHandle, getToolkitLock, getType, getUniqueID, getUnitID, isHandleOwner, lock, swapHandleAndOwnership, 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 dummyEGLGraphicsDevicewith 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 dummyEGLGraphicsDevicereusing the given native display connection with aEGL#EGL_NO_DISPLAYEGL 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 newEGLGraphicsDevicereusing 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 newEGLGraphicsDeviceusingAbstractGraphicsDevice's native display ID and connection, using theEGLGraphicsDevice.EGLDisplayLifecycleCallbackto 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.EGLDisplayLifecycleCallbackto handle this instance's native EGL lifecycle.
-
EGLGraphicsDevice
public EGLGraphicsDevice(long nativeDisplayID, String connection, int unitID, EGLGraphicsDevice.EGLDisplayLifecycleCallback eglLifecycleCallback)Constructs a newEGLGraphicsDeviceusingAbstractGraphicsDevice's native display ID and connection, using theEGLGraphicsDevice.EGLDisplayLifecycleCallbackto 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.EGLDisplayLifecycleCallbackto 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 givenAbstractGraphicsDeviceuses the samegetNativeDisplayID()of this instance.In case given
AbstractGraphicsDeviceis not aEGLGraphicsDevice, itsAbstractGraphicsDevice.getHandle()is being used as the native display id for a matchingEGLGraphicsDeviceinstance.
-
clone
public Object clone()
- Specified by:
clonein interfaceAbstractGraphicsDevice- Overrides:
clonein classDefaultGraphicsDevice
-
open
public boolean open()
Opens the EGL device if handle is null and it'sEGLGraphicsDevice.EGLDisplayLifecycleCallbackis valid.Optionally [re]opening the device if handle is
null.The default implementation is a
NOP.Example implementations like
X11GraphicsDeviceorEGLGraphicsDeviceissue the native open operation in case handle isnull.- Specified by:
openin interfaceAbstractGraphicsDevice- Overrides:
openin classDefaultGraphicsDevice- Returns:
- true if the handle was
nulland opening was successful, otherwise false.
-
close
public boolean close()
Closes the EGL device if handle is not null and it'sEGLGraphicsDevice.EGLDisplayLifecycleCallbackis valid.Optionally closing the device if handle is not
null.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.- Specified by:
closein interfaceAbstractGraphicsDevice- Overrides:
closein classDefaultGraphicsDevice- Returns:
- true if the handle was not
nulland closing was successful, otherwise false.
-
toString
public String toString()
- Overrides:
toStringin classDefaultGraphicsDevice
-
-