Class GLES
- Loads the OpenGL ES native library into the JVM process.
- Creates instances of
GLESCapabilitiesclasses. AGLESCapabilitiesinstance 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
GLESCapabilitiesinstances, 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 voidcreate()Loads the OpenGL ES native library, using the default library name.static voidLoads the OpenGL ES native library, using the specified library name.static voidcreate(FunctionProvider functionProvider) Initializes OpenGL ES with the specifiedFunctionProvider.static GLESCapabilitiesCreates a newGLESCapabilitiesinstance for the OpenGL ES context that is current in the current thread.static GLESCapabilitiescreateCapabilities(@Nullable IntFunction<PointerBuffer> bufferFactory) Creates a newGLESCapabilitiesinstance for the OpenGL ES context that is current in the current thread.static voiddestroy()Unloads the OpenGL ES native library.static GLESCapabilitiesReturns theGLESCapabilitiesof the OpenGL ES context that is current in the current thread.static @Nullable FunctionProviderReturns theFunctionProviderfor the OpenGL ES native library.static voidsetCapabilities(@Nullable GLESCapabilities caps) Sets theGLESCapabilitiesof 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 theFunctionProviderfor the OpenGL ES native library. -
setCapabilities
Sets theGLESCapabilitiesof the OpenGL ES context that is current in the current thread.This
GLESCapabilitiesinstance will be used by any OpenGL ES call in the current thread, untilsetCapabilitiesis called again with a different value. -
getCapabilities
Returns theGLESCapabilitiesof 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 anullvalue
-
createCapabilities
Creates a newGLESCapabilitiesinstance 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
GLESCapabilitiesinstance - Throws:
IllegalStateException- if no OpenGL ES context is current in the current thread
-
createCapabilities
public static GLESCapabilities createCapabilities(@Nullable IntFunction<PointerBuffer> bufferFactory) Creates a newGLESCapabilitiesinstance 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 aPointerBuffergiven a size. The buffer must be filled with zeroes. Ifnull, LWJGL will allocate a GC-managed buffer internally.- Returns:
- the
GLESCapabilitiesinstance - Throws:
IllegalStateException- if no OpenGL ES context is current in the current thread
-