Class GLES
- Loads the OpenGL ES native library into the JVM process.
- Creates instances of
GLESCapabilities
classes. AGLESCapabilities
instance contains flags for functionality that is available in an OpenGL ES context. Internally, it also contains function pointers that are only valid in that specific OpenGL ES context. - Maintains thread-local state for
GLESCapabilities
instances, corresponding to OpenGL ES contexts that are current in those threads.
Library lifecycle
The OpenGL ES library is loaded automatically when this class is initialized. Set the Configuration.OPENGLES_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.OPENGLES_LIBRARY_NAME
option. The maximum OpenGL ES version loaded can be set with the
Configuration.OPENGLES_MAXVERSION
option. This can be useful to ensure that no functionality above a specific version is used during development.
GLESCapabilities creation
Instances of GLESCapabilities
can be created with the createCapabilities()
method. An OpenGL ES context must be current in the current
thread before it is called. Calling this method is expensive, so the GLESCapabilities
instance should be associated with the OpenGL ES context and
reused as necessary.
Thread-local state
Before a function for a given OpenGL ES context can be called, the corresponding GLESCapabilities
instance must be passed to the setCapabilities(org.lwjgl.opengles.GLESCapabilities)
method. The user is also responsible for clearing the current GLESCapabilities
instance when the context is destroyed or made
current in another thread.
Note that the createCapabilities()
method implicitly calls setCapabilities(org.lwjgl.opengles.GLESCapabilities)
with the newly created instance.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
create()
Loads the OpenGL ES native library, using the default library name.static void
Loads the OpenGL ES native library, using the specified library name.static void
create
(FunctionProvider functionProvider) Initializes OpenGL ES with the specifiedFunctionProvider
.static GLESCapabilities
Creates a newGLESCapabilities
instance for the OpenGL ES context that is current in the current thread.static GLESCapabilities
createCapabilities
(IntFunction<PointerBuffer> bufferFactory) Creates a newGLESCapabilities
instance for the OpenGL ES context that is current in the current thread.static void
destroy()
Unloads the OpenGL ES native library.static GLESCapabilities
Returns theGLESCapabilities
of the OpenGL ES context that is current in the current thread.static FunctionProvider
Returns theFunctionProvider
for the OpenGL ES native library.static void
Sets theGLESCapabilities
of the OpenGL ES context that is current in the current thread.
-
Method Details
-
create
public static void create()Loads the OpenGL ES native library, using the default library name. -
create
Loads the OpenGL ES native library, using the specified library name.- Parameters:
libName
- the native library name
-
create
Initializes OpenGL ES with the specifiedFunctionProvider
. This method can be used to implement custom OpenGL ES library loading.- Parameters:
functionProvider
- the provider of OpenGL ES function addresses
-
destroy
public static void destroy()Unloads the OpenGL ES native library. -
getFunctionProvider
Returns theFunctionProvider
for the OpenGL ES native library. -
setCapabilities
Sets theGLESCapabilities
of the OpenGL ES context that is current in the current thread.This
GLESCapabilities
instance will be used by any OpenGL ES call in the current thread, untilsetCapabilities
is called again with a different value. -
getCapabilities
Returns theGLESCapabilities
of the OpenGL ES context that is current in the current thread.- Throws:
IllegalStateException
- ifsetCapabilities(org.lwjgl.opengles.GLESCapabilities)
has never been called in the current thread or was last called with anull
value
-
createCapabilities
Creates a newGLESCapabilities
instance for the OpenGL ES context that is current in the current thread.This method calls
setCapabilities(GLESCapabilities)
with the new instance before returning.- Returns:
- the
GLESCapabilities
instance - Throws:
IllegalStateException
- if no OpenGL ES context is current in the current thread
-
createCapabilities
public static GLESCapabilities createCapabilities(@Nullable IntFunction<PointerBuffer> bufferFactory) Creates a newGLESCapabilities
instance for the OpenGL ES context that is current in the current thread.This method calls
setCapabilities(GLESCapabilities)
with the new instance before returning.- Parameters:
bufferFactory
- a function that allocates aPointerBuffer
given a size. The buffer must be filled with zeroes. Ifnull
, LWJGL will allocate a GC-managed buffer internally.- Returns:
- the
GLESCapabilities
instance - Throws:
IllegalStateException
- if no OpenGL ES context is current in the current thread
-