Class GLES
- java.lang.Object
-
- org.lwjgl.opengles.GLES
-
public final class GLES extends java.lang.ObjectThis class must be used before any OpenGL ES function is called. It has the following responsibilities:- 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_INIToption to override this behavior. Manual loading/unloading can be achieved with theGLES.create()andGLES.destroy()functions. The name of the library loaded can be overridden with theConfiguration.OPENGLES_LIBRARY_NAMEoption. The maximum OpenGL ES version loaded can be set with theConfiguration.OPENGLES_MAXVERSIONoption. This can be useful to ensure that no functionality above a specific version is used during development.GLESCapabilities creation
Instances of
GLESCapabilitiescan be created with theGLES.createCapabilities()method. An OpenGL ES context must be current in the current thread before it is called. Calling this method is expensive, so theGLESCapabilitiesinstance 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
GLESCapabilitiesinstance must be passed to theGLES.setCapabilities(org.lwjgl.opengles.GLESCapabilities)method. The user is also responsible for clearing the currentGLESCapabilitiesinstance when the context is destroyed or made current in another thread.Note that the
GLES.createCapabilities()method implicitly callsGLES.setCapabilities(org.lwjgl.opengles.GLESCapabilities)with the newly created instance.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static voidcreate()Loads the OpenGL ES native library, using the default library name.static voidcreate(FunctionProvider functionProvider)Initializes OpenGL ES with the specifiedFunctionProvider.static voidcreate(java.lang.String libName)Loads the OpenGL ES native library, using the specified library name.static GLESCapabilitiescreateCapabilities()Creates a newGLESCapabilitiesinstance for the OpenGL ES context that is current in the current thread.static voiddestroy()Unloads the OpenGL ES native library.static GLESCapabilitiesgetCapabilities()Returns theGLESCapabilitiesof the OpenGL ES context that is current in the current thread.static FunctionProvidergetFunctionProvider()Returns theFunctionProviderfor the OpenGL ES native library.static voidsetCapabilities(GLESCapabilities caps)Sets theGLESCapabilitiesof the OpenGL ES context that is current in the current thread.
-
-
-
Method Detail
-
create
public static void create()
Loads the OpenGL ES native library, using the default library name.
-
create
public static void create(java.lang.String libName)
Loads the OpenGL ES native library, using the specified library name.- Parameters:
libName- the native library name
-
create
public static void create(FunctionProvider functionProvider)
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
public static FunctionProvider getFunctionProvider()
Returns theFunctionProviderfor the OpenGL ES native library.
-
setCapabilities
public static void setCapabilities(GLESCapabilities caps)
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
public static GLESCapabilities getCapabilities()
Returns theGLESCapabilitiesof the OpenGL ES context that is current in the current thread.- Throws:
java.lang.IllegalStateException- ifGLES.setCapabilities(org.lwjgl.opengles.GLESCapabilities)has never been called in the current thread or was last called with anullvalue
-
createCapabilities
public static GLESCapabilities createCapabilities()
Creates a newGLESCapabilitiesinstance for the OpenGL ES context that is current in the current thread.This method calls
GLES.setCapabilities(GLESCapabilities)with the new instance before returning.- Returns:
- the
GLESCapabilitiesinstance - Throws:
java.lang.IllegalStateException- if no OpenGL ES context is current in the current thread
-
-