GLCapabilities classes. A GLCapabilities instance contains flags for functionality that is available in an OpenGL
context. Internally, it also contains function pointers that are only valid in that specific OpenGL context.GLCapabilities instances, corresponding to OpenGL contexts that are current in those threads.The OpenGL library is loaded automatically when this class is initialized. Set the Configuration#OPENGL_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#OPENGL_LIBRARY_NAME option. The maximum OpenGL version loaded can be set with the Configuration#OPENGL_MAXVERSION
option. This can be useful to ensure that no functionality above a specific version is used during development.
Instances of GLCapabilities can be created with the createCapabilities method. An OpenGL context must be current in the current thread
before it is called. Calling this method is expensive, so the GLCapabilities instance should be associated with the OpenGL context and reused as
necessary.
Before a function for a given OpenGL context can be called, the corresponding GLCapabilities instance must be passed to the
setCapabilities method. The user is also responsible for clearing the current GLCapabilities 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.
| Modifier and Type | Class and Description |
|---|---|
| private static interface | GL.
Function pointer provider. |
| private static class | GL.
Write-once |
| Modifier and Type | Field and Description |
|---|---|
| private static GLXCapabilities | |
| private static GLXCapabilities | |
| private static final ThreadLocal | |
| private static WGLCapabilities | |
| private static FunctionProvider | |
| private static GL. | |
| private static final APIUtil. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static GLCapabilities | |
| public static void | |
| public static void | |
| private static void | |
| public static void | create(FunctionProvider
the provider of OpenGL function addresses functionProvider)Initializes OpenGL with the specified |
| public static GLCapabilities | Returns: the GLCapabilities instanceCreates a new |
| public static GLCapabilities | Returns: the GLCapabilities instancea function that allocates a bufferFactory)PointerBuffer given a size. The buffer must be filled with zeroes. If null, LWJGL will
allocate a GC-managed buffer internally.Creates a new |
| public static GLCapabilities | Returns: the GLCapabilities instanceif true, LWJGL will create forward compatible capabilities forwardCompatible)Creates a new |
| public static GLCapabilities | Returns: the GLCapabilities instanceif true, LWJGL will create forward compatible capabilities forwardCompatible, IntFunction<PointerBuffer> a function that allocates a bufferFactory)PointerBuffer given a size. If null, LWJGL will allocate a GC-managed buffer
internally.Creates a new |
| public static GLXCapabilities | createCapabilitiesGLX(long
the X connection handle ( display)DISPLAY)Creates a |
| public static GLXCapabilities | createCapabilitiesGLX(long
the X connection handle ( display, int DISPLAY)the screen index screen)Creates a |
| public static WGLCapabilities | createCapabilitiesWGL()
Creates a |
| private static WGLCapabilities | createCapabilitiesWGL(long
the device context handle ( hdc)HDC)Creates a |
| private static WGLCapabilities | |
| public static void | |
| public static GLCapabilities | getCapabilities()
Returns the |
| public static GLXCapabilities | |
| pack-priv static GLXCapabilities | |
| public static WGLCapabilities | |
| public static FunctionProvider | |
| pack-priv static GLCapabilities | |
| private static GLXCapabilities | |
| pack-priv static void | |
| public static void | setCapabilities(GLCapabilities caps)
Sets the |
| capabilitiesGLX | back to summary |
|---|---|
| private static GLXCapabilities capabilitiesGLX
| |
| capabilitiesGLXClient | back to summary |
|---|---|
| private static GLXCapabilities capabilitiesGLXClient
| |
| capabilitiesTLS | back to summary |
|---|---|
| private static final ThreadLocal<GLCapabilities> capabilitiesTLS | |
| capabilitiesWGL | back to summary |
|---|---|
| private static WGLCapabilities capabilitiesWGL
| |
| functionProvider | back to summary |
|---|---|
| private static FunctionProvider functionProvider
| |
| icd | back to summary |
|---|---|
| private static GL. | |
| MAX_VERSION | back to summary |
|---|---|
| private static final APIUtil. | |
| GL | back to summary |
|---|---|
| private GL() | |
| checkCapabilities | back to summary |
|---|---|
| private static GLCapabilities checkCapabilities(GLCapabilities caps) | |
| create | back to summary |
|---|---|
| public static void create() Loads the OpenGL native library, using the default library name. | |
| create | back to summary |
|---|---|
| public static void create(String libName) Loads the OpenGL native library, using the specified library name.
| |
| create | back to summary |
|---|---|
| private static void create(SharedLibrary OPENGL) | |
| create | back to summary |
|---|---|
| public static void create(FunctionProvider functionProvider) Initializes OpenGL with the specified
| |
| createCapabilities | back to summary |
|---|---|
| public static GLCapabilities createCapabilities() Creates a new Depending on the current context, the instance returned may or may not contain the deprecated functionality removed since OpenGL version 3.1. This method calls
| |
| createCapabilities | back to summary |
|---|---|
| public static GLCapabilities createCapabilities(IntFunction<PointerBuffer> bufferFactory) Creates a new Depending on the current context, the instance returned may or may not contain the deprecated functionality removed since OpenGL version 3.1. This method calls
| |
| createCapabilities | back to summary |
|---|---|
| public static GLCapabilities createCapabilities(boolean forwardCompatible) Creates a new Depending on the current context, the instance returned may or may not contain the deprecated functionality removed since OpenGL version 3.1. The
This method calls
| |
| createCapabilities | back to summary |
|---|---|
| public static GLCapabilities createCapabilities(boolean forwardCompatible, IntFunction<PointerBuffer> bufferFactory) Creates a new Depending on the current context, the instance returned may or may not contain the deprecated functionality removed since OpenGL version 3.1. The
This method calls
| |
| createCapabilitiesGLX | back to summary |
|---|---|
| public static GLXCapabilities createCapabilitiesGLX(long display) Creates a This method may only be used on Linux.
| |
| createCapabilitiesGLX | back to summary |
|---|---|
| public static GLXCapabilities createCapabilitiesGLX(long display, int screen) Creates a This method may only be used on Linux.
| |
| createCapabilitiesWGL | back to summary |
|---|---|
| public static WGLCapabilities createCapabilitiesWGL() Creates a This method may only be used on Windows. | |
| createCapabilitiesWGL | back to summary |
|---|---|
| private static WGLCapabilities createCapabilitiesWGL(long hdc) Creates a
| |
| createCapabilitiesWGLDummy | back to summary |
|---|---|
| private static WGLCapabilities createCapabilitiesWGLDummy() Creates a dummy context and retrieves the WGL capabilities. | |
| destroy | back to summary |
|---|---|
| public static void destroy() Unloads the OpenGL native library. | |
| getCapabilities | back to summary |
|---|---|
| public static GLCapabilities getCapabilities() Returns the
| |
| getCapabilitiesGLX | back to summary |
|---|---|
| public static GLXCapabilities getCapabilitiesGLX() Returns the GLX capabilities. This method may only be used on Linux. | |
| getCapabilitiesGLXClient | back to summary |
|---|---|
| pack-priv static GLXCapabilities getCapabilitiesGLXClient() Returns the GLX client capabilities. | |
| getCapabilitiesWGL | back to summary |
|---|---|
| public static WGLCapabilities getCapabilitiesWGL() Returns the WGL capabilities. This method may only be used on Windows. | |
| getFunctionProvider | back to summary |
|---|---|
| public static FunctionProvider getFunctionProvider() Returns the
| |
| getICD | back to summary |
|---|---|
| pack-priv static GLCapabilities getICD() | |
| initCapabilitiesGLX | back to summary |
|---|---|
| private static GLXCapabilities initCapabilitiesGLX(boolean client) | |
| initialize | back to summary |
|---|---|
| pack-priv static void initialize() Ensures that the lwjgl_opengl shared library has been loaded. | |
| setCapabilities | back to summary |
|---|---|
| public static void setCapabilities(GLCapabilities caps) Sets the This | |
| Modifier and Type | Method and Description |
|---|---|
| public GLCapabilities | |
| public default void |
| get | back to summary |
|---|---|
public GLCapabilities get()
| |
| set | back to summary |
|---|---|
| public default void set(GLCapabilities caps) | |
ICD.
This is the default implementation that skips the thread-local lookup. When a new GLCapabilities is set, we compare it to the write-once capabilities. If different function pointers are found, we fall back to the expensive lookup.
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static GLCapabilities |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public GLCapabilities | |
| public void |
| tempCaps | back to summary |
|---|---|
| private static GLCapabilities tempCaps
| |
| ICDStatic | back to summary |
|---|---|
| private ICDStatic() | |
| get | back to summary |
|---|---|
| public GLCapabilities get() Implements org.
| |
| set | back to summary |
|---|---|
| public void set(GLCapabilities caps) Overrides default org.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final GLCapabilities |
| Access | Constructor and Description |
|---|---|
| private |
| caps | back to summary |
|---|---|
| pack-priv static final GLCapabilities caps | |
| WriteOnce | back to summary |
|---|---|
| private WriteOnce() | |