Class 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. A GLESCapabilities 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 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.
        libName - the native library name
      • create

        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.
        functionProvider - the provider of OpenGL ES function addresses
      • destroy

        public static void destroy()
        Unloads the OpenGL ES native library.
      • setCapabilities

        public static void setCapabilities​(@Nullable
                                           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.

      • createCapabilities

        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.

        the GLESCapabilities instance
        java.lang.IllegalStateException - if no OpenGL ES context is current in the current thread