Top Description Inners Fields Constructors Methods
org.lwjgl.opengles

public final Class GLES

extends Object
Class Inheritance
Imports
org.lwjgl.*, org.lwjgl.system.*, javax.annotation.*, java.nio.*, java.util.*, java.util.function.*

This class must be used before any OpenGL ES function is called. It has the following responsibilities:

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 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 with the newly created instance.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static interface
GLES.ICD

Function pointer provider.

private static class
GLES.ICDStatic

Write-once ICD.

Field Summary

Modifier and TypeField and Description
private static final ThreadLocal<GLESCapabilities>
private static FunctionProvider
private static GLES.ICD
private static final APIUtil.APIVersion

Constructor Summary

AccessConstructor and Description
private
GLES()

Method Summary

Modifier and TypeMethod and Description
private static GLESCapabilities
public static void
create()

Loads the OpenGL ES native library, using the default library name.

public static void
create(String
the native library name
libName
)

Loads the OpenGL ES native library, using the specified library name.

private static void
public static void
create(FunctionProvider
the provider of OpenGL ES function addresses
functionProvider
)

Initializes OpenGL ES with the specified FunctionProvider.

public static GLESCapabilities

Returns:

the GLESCapabilities instance
createCapabilities
()

Creates a new GLESCapabilities instance for the OpenGL ES context that is current in the current thread.

public static GLESCapabilities

Returns:

the GLESCapabilities instance
createCapabilities
(IntFunction<PointerBuffer>
a function that allocates a PointerBuffer given a size. The buffer must be filled with zeroes. If null, LWJGL will allocate a GC-managed buffer internally.
bufferFactory
)

Creates a new GLESCapabilities instance for the OpenGL ES context that is current in the current thread.

public static void
destroy()

Unloads the OpenGL ES native library.

public static GLESCapabilities
getCapabilities()

Returns the GLESCapabilities of the OpenGL ES context that is current in the current thread.

private static FunctionProvider
public static FunctionProvider
getFunctionProvider()

Returns the FunctionProvider for the OpenGL ES native library.

pack-priv static GLESCapabilities
pack-priv static void
initialize()

Ensures that the lwjgl_opengles shared library has been loaded.

public static void
setCapabilities(GLESCapabilities caps)

Sets the GLESCapabilities of the OpenGL ES context that is current in the current thread.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

capabilitiesTLSback to summary
private static final ThreadLocal<GLESCapabilities> capabilitiesTLS
functionProviderback to summary
private static FunctionProvider functionProvider
Annotations
@Nullable
icdback to summary
private static GLES.ICD icd
MAX_VERSIONback to summary
private static final APIUtil.APIVersion MAX_VERSION
Annotations
@Nullable

Constructor Detail

GLESback to summary
private GLES()

Method Detail

checkCapabilitiesback to summary
private static GLESCapabilities checkCapabilities(GLESCapabilities caps)
createback to summary
public static void create()

Loads the OpenGL ES native library, using the default library name.

createback to summary
public static void create(String libName)

Loads the OpenGL ES native library, using the specified library name.

Parameters
libName:String

the native library name

createback to summary
private static void create(SharedLibrary GLES)
createback to summary
public static void create(FunctionProvider functionProvider)

Initializes OpenGL ES with the specified FunctionProvider. This method can be used to implement custom OpenGL ES library loading.

Parameters
functionProvider:FunctionProvider

the provider of OpenGL ES function addresses

createCapabilitiesback to summary
public static GLESCapabilities createCapabilities()

Creates a new GLESCapabilities 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:GLESCapabilities

the GLESCapabilities instance

Exceptions
IllegalStateException:
if no OpenGL ES context is current in the current thread
createCapabilitiesback to summary
public static GLESCapabilities createCapabilities(IntFunction<PointerBuffer> bufferFactory)

Creates a new GLESCapabilities 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:IntFunction<PointerBuffer>

a function that allocates a PointerBuffer given a size. The buffer must be filled with zeroes. If null, LWJGL will allocate a GC-managed buffer internally.

Returns:GLESCapabilities

the GLESCapabilities instance

Exceptions
IllegalStateException:
if no OpenGL ES context is current in the current thread
destroyback to summary
public static void destroy()

Unloads the OpenGL ES native library.

getCapabilitiesback to summary
public static GLESCapabilities getCapabilities()

Returns the GLESCapabilities of the OpenGL ES context that is current in the current thread.

Exceptions
IllegalStateException:
if setCapabilities has never been called in the current thread or was last called with a null value
getContextProviderback to summary
private static FunctionProvider getContextProvider()
Annotations
@Nullable
getFunctionProviderback to summary
public static FunctionProvider getFunctionProvider()

Returns the FunctionProvider for the OpenGL ES native library.

Annotations
@Nullable
getICDback to summary
pack-priv static GLESCapabilities getICD()
initializeback to summary
pack-priv static void initialize()

Ensures that the lwjgl_opengles shared library has been loaded.

setCapabilitiesback to summary
public static void setCapabilities(GLESCapabilities caps)

Sets the GLESCapabilities 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, until setCapabilities is called again with a different value.

org.lwjgl.opengles back to summary

private Interface GLES.ICD

Known Direct Implementers
org.lwjgl.opengles.GLES.ICDStatic

Function pointer provider.

Method Summary

Modifier and TypeMethod and Description
public GLESCapabilities
get()

public default void

Method Detail

getback to summary
public GLESCapabilities get()
Annotations
@Nullable
setback to summary
public default void set(GLESCapabilities caps)
org.lwjgl.opengles back to summary

private Class GLES.ICDStatic

extends Object
implements ICD
Class Inheritance
All Implemented Interfaces
org.lwjgl.opengles.GLES.ICD

Write-once ICD.

This is the default implementation that skips the thread-local lookup. When a new GLESCapabilities is set, we compare it to the write-once capabilities. If different function pointers are found, we fall back to the expensive lookup.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static GLESCapabilities

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public GLESCapabilities
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

tempCapsback to summary
private static GLESCapabilities tempCaps
Annotations
@Nullable

Constructor Detail

ICDStaticback to summary
private ICDStatic()

Method Detail

getback to summary
public GLESCapabilities get()

Implements org.lwjgl.opengles.GLES.ICD.get.

Annotations
@Override
setback to summary
public void set(GLESCapabilities caps)

Overrides default org.lwjgl.opengles.GLES.ICD.set.

Annotations
@SuppressWarnings:AssignmentToStaticFieldFromInstanceMethod
@Override
org.lwjgl.opengles back to summary

private final Class GLES.ICDStatic.WriteOnce

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv static final GLESCapabilities

Constructor Summary

AccessConstructor and Description
private

Field Detail

capsback to summary
pack-priv static final GLESCapabilities caps

Constructor Detail

WriteOnceback to summary
private WriteOnce()