|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.newdawn.slick.opengl.SlickCallable
public abstract class SlickCallable
A utility to allow performing GL operations without contaminating the
Slick OpenGL state. Note this will not protect you from OpenGL programming errors
like a glBegin() without a glEnd(), or glPush() without glPop() etc.
Expected usage:
SlickCallable callable = new SlickCallable() {
public performGLOperations() throws SlickException {
GL.glTranslate(0,0,1);
glBegin(GL.GL_POLYGONS);
glVertex(..);
...
glEnd();
}
}
callable.call();
Alternatively you can use the static methods directly
SlickCallable.enterSafeBlock();
GL.glTranslate(0,0,1);
glBegin(GL.GL_POLYGONS);
glVertex(..);
...
glEnd();
SlickCallable.leaveSafeBlock();
Constructor Summary | |
---|---|
SlickCallable()
|
Method Summary | |
---|---|
void |
call()
Cause this callable to perform it's GL operations (@see performGLOperations()). |
static void |
enterSafeBlock()
Enter a safe block ensuring that all the OpenGL state that slick uses is safe before touching the GL state directly. |
static void |
leaveSafeBlock()
Leave a safe block ensuring that all of Slick's OpenGL state is restored since the last enter. |
protected abstract void |
performGLOperations()
Perform the GL operations that this callable is intended to. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SlickCallable()
Method Detail |
---|
public static void enterSafeBlock()
public static void leaveSafeBlock()
public final void call() throws SlickException
SlickException
- Indicates a failure while performing the GL operations or
maintaing SlickStateprotected abstract void performGLOperations() throws SlickException
SlickException
- Indicates a failure of some sort. This is user exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |