|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjpl.mipl.jade.jadis.agile2d.AgileState
public class AgileState
AgileState locally keeps OpenGL state to avoid useless
state changes that are very expensive in OpenGL.
Note: AgileGraphics2D uses AgileState to manage all state changes. To interact well with AgileGraphics2D, use AgileState to manage state, or use the AgileGraphics2D.run() method to run code in a safe context. e.g.
AgileState agileState = AgileState.get(gl);
...
agileState.glEnable(GL.GL_TEXTURE_2D);
agileState.bindTexture2D(0);
if (agileState.setState(GL.GL_TEXTURE_ENV_MODE, GL.GL_MODULATE)) {
gl.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_MODULATE);
}
agileState.glDisable(GL.GL_TEXTURE_2D);
| Constructor Summary | |
|---|---|
protected |
AgileState(javax.media.opengl.GL gl)
AgileState constructor. |
| Method Summary | |
|---|---|
void |
bindTexture1D(int tex)
|
void |
bindTexture2D(int tex)
|
protected void |
checkError()
|
static AgileState |
get(javax.media.opengl.GL gl)
Get/Create a AgileState object for a GL context. |
javax.media.opengl.GL |
getGL()
Returns the GL context. |
int |
getState(int attrib)
Returns the value currently associated with the specified GL attribute. |
String |
getVersion()
Returns a String representing the version of the OpenGL implementation. |
void |
glColor4f(float r,
float g,
float b,
float a)
|
void |
glColor4ub(byte r,
byte g,
byte b,
byte a)
|
void |
glDisable(int attrib)
Equivalent to glDisable but checks the value first and skip the GL function is the value is already set to 0. |
void |
glDisableClientState(int mode)
|
void |
glEnable(int attrib)
Equivalent to glEnable but checks the value first and skip the GL function is the value is already set to 1. |
void |
glEnableClientState(int mode)
|
void |
glLogicOp(int op)
|
void |
glSetShadeModel(int model)
|
void |
restore()
Pops all GL attributes from the GL state stack, using glPopAttrib and glPopClientAttrib. |
void |
save()
Pushes all GL attributes onto the GL state stack, using glPushAttrib and glPushClientAttrib. |
boolean |
setState(int attrib,
int value)
Sets the value currently associated with a specified GL attribute. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected AgileState(javax.media.opengl.GL gl)
gl - the GL context.| Method Detail |
|---|
public static AgileState get(javax.media.opengl.GL gl)
AgileState object for a GL context.
gl - the GL context
public String getVersion()
public javax.media.opengl.GL getGL()
public int getState(int attrib)
attrib - the GL attribute
public boolean setState(int attrib,
int value)
true if the value is different from the one
in the GL state, meaning that a GL primitive should be used to set it.
* @param attrib the attribute
value - the value r
true if the value is different from the one
in the GL state, meaning that a GL primitive should be used to set it.protected void checkError()
public void glEnable(int attrib)
attrib - the attribute to set.public void glDisable(int attrib)
attrib - the attribute to set.public void bindTexture1D(int tex)
public void bindTexture2D(int tex)
public void glSetShadeModel(int model)
public void glEnableClientState(int mode)
public void glDisableClientState(int mode)
public void glLogicOp(int op)
public void glColor4ub(byte r,
byte g,
byte b,
byte a)
public void glColor4f(float r,
float g,
float b,
float a)
public void save()
public void restore()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||