All Packages This Package Class Hierarchy Class Search Index
java.lang.Object | +----com.hermetica.magician.GLContext
Summary |
public class GLContext extends java.lang.Object { // Fields 1 public static final String VERSION; // Constructors 4 public GLContext(); public GLContext(boolean); public GLContext(GLCapabilities); public GLContext(GLCapabilities, boolean); // Methods 15 public static GLContext getCurrentContext(); public static boolean getTraceStatus(); public static final synchronized void lock(); public static void setTraceStatus(boolean); public static final synchronized void unlock(); public boolean createContext(GLDrawable); public void destroy() throws GLContextException;public void destroyContext() throws GLContextException; public GLCapabilities getCapabilities(); public GLComponent getComponent(); public boolean isInitialized(); public void makeCurrent() throws GLContextException; public void setCapabilities(GLCapabilities); protected void setComponent(GLDrawable); public void swapBuffers() throws GLContextException; }
This class encapsulates an OpenGL rendering context. This object is associated with a drawing surface, beit and X Widget or Win32 HDC which funnels all OpenGL calls onto that surface. Each rendering context has a set of ``capabilities'' associated with it which are used to select the most apt device context to render onto. After the context successfully acquires a device to render to, the capabilities may not be changed.
See Also: GLComponent, GLCapabilities
Cross Reference |
Fields |
· VERSION | Summary | Top |
public static final String VERSION
Version information
Constructors |
· GLContext | Summary | Top |
public GLContext()
Default context constructor. This has a default set of capabilities that is probably unsuitable for all visuals!
See Also: GLCapabilities
· GLContext | Summary | Top |
public GLContext(GLCapabilities capabilities)
Context constructor using a previously prepared set of capabilities. The capability object being used is actually cloned not pointed to. This means that the same capability can be used to initialize multiple rendering contexts, instead of being indirectly locked after the first rendering context creation succeeds.
See Also: GLCapabilities
· GLContext | Summary | Top |
public GLContext(boolean mode)
Context constructor with the locking trace level specified. This constructor uses a default set of capabilities that should be configured to suit your target visual capabilities.
Parameter Description mode Lock tracing mode.
· GLContext | Summary | Top |
public GLContext(GLCapabilities capabilities, boolean mode)
Context constructor with the locking trace level specified as well as a non-default set of context capabilities.
Parameter Description capabilities The configured capabilities for this context mode The context lock tracing level
Methods |
· isInitialized | Summary | Top |
public boolean isInitialized()
Returns the current initialization status of the context
· setTraceStatus | Summary | Top |
public static void setTraceStatus(boolean mode)
Sets the tracing level of the context lock.
· getTraceStatus | Summary | Top |
public static boolean getTraceStatus()
Returns the current tracing status
· getCurrentContext | Summary | Top |
public static GLContext getCurrentContext()
Returns the current GLContext in OpenGL, if one exists
· setComponent | Summary | Top |
protected void setComponent(GLDrawable component)
Sets the GLComponent associated with this context
· getComponent | Summary | Top |
public GLComponent getComponent()
Returns the GLComponent associated with this context
· createContext | Summary | Top |
public boolean createContext(GLDrawable component)
Checks to see whether or not a context is created
· destroyContext | Summary | Top |
public void destroyContext() throws GLContextException
Note: destroyContext() is deprecated This method has been deprecated in favour of ``destroy()''. It will be removed as of beta 4 or a final release of Magician
Destroys the context and frees any resources associated with it
Parameter Description component A GLComponent associated with this context
- Throws: GLContextException
- GL context exception
See Also: destroy
· destroy | Summary | Top |
public void destroy() throws GLContextException
Destroys the context and frees any resources associated with it. This method replaces ``destroyContext()''
Parameter Description component A GLComponent associated with this context
- Throws: GLContextException
- GL context exception
See Also: destroyContext
· lock | Summary | Top |
public static final synchronized void lock()
Locks the OpenGL context for exclusive use. This is generally done internally, but in some cases developers may wish to enforce synchronization.
· unlock | Summary | Top |
public static final synchronized void unlock()
Releases the OpenGL context for use elsewhere. This essentially unlocks the mutex on this object. This is a potentially destructive operation unless you can guarantee no other OpenGL activity is occurring within your program when you make this call, eg, you are simply initializing the frustrum or somesuch. If you unlock the mutex during heavy multi-threaded OpenGL activity, there is a possibility that critical sections of code will not be respected and context cross-over may occur.
· makeCurrent | Summary | Top |
public void makeCurrent() throws GLContextException
Makes this context the current one within the OpenGL state machine
· swapBuffers | Summary | Top |
public void swapBuffers() throws GLContextException
Swaps the buffers of a context, if double-buffering is used
· getCapabilities | Summary | Top |
public GLCapabilities getCapabilities()
Returns the GLCapabilities object associated with this context
See Also: GLCapabilities
· setCapabilities | Summary | Top |
public void setCapabilities(GLCapabilities capability)
Sets the capabilities of this context to a brand-new object. This is not actually possible if the capabilities object already associated with this context is locked, ie, the context is already created.
See Also: GLCapabilities
All Packages This Package Class Hierarchy Class Search IndexFreshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7