Class EGL
This class must be used before any EGL function is called. It has the following responsibilities:
- Loads the EGL native library into the JVM process.
- Creates instances of
EGLCapabilities
classes. AnEGLCapabilities
instance contains flags for functionality that is available in an EGLDisplay or the EGL client library. Internally, it also contains function pointers that are only valid in that specific EGLDisplay or client library.
Library lifecycle
The EGL library is loaded automatically when this class is initialized. Set the Configuration.EGL_EXPLICIT_INIT
option to override this behavior.
Manual loading/unloading can be achieved with the create()
and destroy()
functions. The name of the library loaded can be overridden with the
Configuration.EGL_LIBRARY_NAME
option.
EGLCapabilities creation
Instances of EGLCapabilities
for an EGLDisplay can be created with the createDisplayCapabilities(long)
method. Calling this method is
expensive, so the EGLCapabilities
instance should be associated with the EGLDisplay and reused as necessary.
The EGLCapabilities
instance for the client library is created automatically when the EGL native library is loaded.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
create()
Loads the EGL native library, using the default library name.static void
Loads the EGL native library, using the specified library name.static void
create
(FunctionProvider functionProvider) Initializes EGL with the specifiedFunctionProvider
.static EGLCapabilities
createDisplayCapabilities
(long dpy) Creates anEGLCapabilities
instance for the specified EGLDisplay handle.static EGLCapabilities
createDisplayCapabilities
(long dpy, int majorVersion, int minorVersion) Creates anEGLCapabilities
instance for the specified EGLDisplay handle.static void
destroy()
Unloads the EGL native library.static EGLCapabilities
Returns theEGLCapabilities
instance for the EGL client library.static FunctionProvider
Returns theFunctionProvider
for the EGL native library.
-
Method Details
-
create
public static void create()Loads the EGL native library, using the default library name. -
create
Loads the EGL native library, using the specified library name.- Parameters:
libName
- the native library name
-
create
Initializes EGL with the specifiedFunctionProvider
. This method can be used to implement custom EGL library loading.- Parameters:
functionProvider
- the provider of EGL function addresses
-
destroy
public static void destroy()Unloads the EGL native library. -
getFunctionProvider
Returns theFunctionProvider
for the EGL native library. -
getCapabilities
Returns theEGLCapabilities
instance for the EGL client library. The capability flags in this instance are only set for the core EGL versions and client extensions. This may only happen if EGL 1.5 or theEGLCapabilities.EGL_EXT_client_extensions
extension are supported. If not, all flags will be false and the version fields zero. -
createDisplayCapabilities
Creates anEGLCapabilities
instance for the specified EGLDisplay handle.This method call is relatively expensive. The result should be cached and reused.
- Parameters:
dpy
- the EGLDisplay to query- Returns:
- the
instance
-
createDisplayCapabilities
public static EGLCapabilities createDisplayCapabilities(long dpy, int majorVersion, int minorVersion) Creates anEGLCapabilities
instance for the specified EGLDisplay handle.This method call is relatively expensive. The result should be cached and reused.
- Parameters:
dpy
- the EGLDisplay to querymajorVersion
- the major EGL version supported by the EGLDisplay, as returned byEGL10.eglInitialize(long, java.nio.IntBuffer, java.nio.IntBuffer)
minorVersion
- the minor EGL version supported by the EGLDisplay, as returned byEGL10.eglInitialize(long, java.nio.IntBuffer, java.nio.IntBuffer)
- Returns:
- the
instance
-