|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.lwjgl.opengl.GLContext
public final class GLContext
Manages GL contexts. Before any rendering is done by a LWJGL system, a call should be made to GLContext.useContext() with a context. This will ensure that GLContext has an accurate reflection of the current context's capabilities and function pointers. This class is thread-safe in the sense that multiple threads can safely call all public methods. The class is also thread-aware in the sense that it tracks a per-thread current context (including capabilities and function pointers). That way, multiple threads can have multiple contexts current and render to them concurrently.
Constructor Summary | |
---|---|
GLContext()
|
Method Summary | |
---|---|
static ContextCapabilities |
getCapabilities()
Get the current capabilities instance. |
static void |
loadOpenGLLibrary()
If the OpenGL reference count is 0, the library is loaded. |
static void |
unloadOpenGLLibrary()
The OpenGL library reference count is decremented, and if it reaches 0, the library is unloaded. |
static void |
useContext(java.lang.Object context)
Makes a GL context the current LWJGL context by loading GL function pointers. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GLContext()
Method Detail |
---|
public static ContextCapabilities getCapabilities()
public static void useContext(java.lang.Object context) throws LWJGLException
If the context is the same as last time, then this is a no-op.
If the context has not been encountered before it will be fully initialized from scratch. Otherwise a cached set of caps and function pointers will be used.
The reference to the context is held in a weak reference; therefore if no strong reference exists to the GL context it will automatically be forgotten by the VM at an indeterminate point in the future, freeing up a little RAM.
context
- The context object, which uniquely identifies a GL context. If context is null, the native stubs are
unloaded.
LWJGLException
- if context non-null, and the gl library can't be loaded or the basic GL11 functions can't be loadedpublic static void loadOpenGLLibrary() throws LWJGLException
LWJGLException
public static void unloadOpenGLLibrary()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |