|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.mines.jtk.opengl.GlContext
public class GlContext
An OpenGL context. All OpenGL rendering is performed using the current OpenGL context. A thread sets the current context by locking it. After rendering, that thread unlocks the context. At any time, a single thread may hold the lock to no more than one context. Multiple threads cannot simultaneously hold the lock to one context. Therefore, contexts should be unlocked sometime after they are locked.
To ensure that each call to lock() is paired with a call to
unlock(), perform the latter in a finally block, as in this
example:
context.lock();
try {
// ...
// render using various OpenGL methods
// ...
context.swapBuffers();
} finally {
context.unlock();
}
| Constructor Summary | |
|---|---|
GlContext(java.awt.Canvas canvas)
Constructs an OpenGL context for the specified canvas. |
|
| Method Summary | |
|---|---|
void |
dispose()
Dispose this context. |
protected void |
finalize()
|
boolean |
isDisposed()
Determines whether this context has been disposed. |
boolean |
isLocked()
Determines whether the current thread has this context locked. |
void |
lock()
Locks this context. |
void |
swapBuffers()
Swaps the front and back buffers for this context. |
void |
unlock()
Unlocks this context. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public GlContext(java.awt.Canvas canvas)
canvas - the canvas.| Method Detail |
|---|
public void lock()
java.lang.IllegalStateException - if the current thread already
has another OpenGL context locked.public void unlock()
java.lang.IllegalStateException - if the current thread does
not already have this OpenGL context locked.public boolean isLocked()
public void swapBuffers()
public void dispose()
public boolean isDisposed()
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||