Class GLES
- java.lang.Object
-
- org.lwjgl.opengles.GLES
-
public final class GLES extends java.lang.Object
This 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
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 thecreate()
anddestroy()
functions. The name of the library loaded can be overridden with theConfiguration.OPENGLES_LIBRARY_NAME
option. The maximum OpenGL ES version loaded can be set with theConfiguration.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 thecreateCapabilities()
method. An OpenGL ES context must be current in the current thread before it is called. Calling this method is expensive, so theGLESCapabilities
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 thesetCapabilities(org.lwjgl.opengles.GLESCapabilities)
method. The user is also responsible for clearing the currentGLESCapabilities
instance when the context is destroyed or made current in another thread.Note that the
createCapabilities()
method implicitly callssetCapabilities(org.lwjgl.opengles.GLESCapabilities)
with the newly created instance.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
create()
Loads the OpenGL ES native library, using the default library name.static void
create(java.lang.String libName)
Loads the OpenGL ES native library, using the specified library name.static void
create(org.lwjgl.system.FunctionProvider functionProvider)
Initializes OpenGL ES with the specifiedFunctionProvider
.static GLESCapabilities
createCapabilities()
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
getCapabilities()
Returns theGLESCapabilities
of the OpenGL ES context that is current in the current thread.static org.lwjgl.system.FunctionProvider
getFunctionProvider()
Returns theFunctionProvider
for the OpenGL ES native library.static void
setCapabilities(GLESCapabilities caps)
Sets theGLESCapabilities
of 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(org.lwjgl.system.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
@Nullable public static org.lwjgl.system.FunctionProvider getFunctionProvider()
Returns theFunctionProvider
for the OpenGL ES native library.
-
setCapabilities
public static void setCapabilities(@Nullable GLESCapabilities caps)
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
public static GLESCapabilities getCapabilities()
Returns theGLESCapabilities
of the OpenGL ES context that is current in the current thread.- Throws:
java.lang.IllegalStateException
- ifsetCapabilities(org.lwjgl.opengles.GLESCapabilities)
has never been called in the current thread or was last called with anull
value
-
createCapabilities
public static GLESCapabilities 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:
java.lang.IllegalStateException
- if no OpenGL ES context is current in the current thread
-
-