edu.mines.jtk.sgl
Class ColorState

java.lang.Object
  extended by edu.mines.jtk.sgl.ColorState
All Implemented Interfaces:
State

public class ColorState
extends java.lang.Object
implements State

OpenGL color state.

Version:
2005.05.31
Author:
Dave Hale, Colorado School of Mines

Constructor Summary
ColorState()
          Constructs color state.
 
Method Summary
 void apply()
          Applies this OpenGL state.
 int getAttributeBits()
          Gets the OpenGL attribute bits for this state.
 java.awt.Color getColor()
          Gets the current color.
 int getShadeModel()
          Gets the shade model.
 boolean hasColor()
          Determines whether current color is set.
 boolean hasShadeModel()
          Determines whether shade model is set.
 void setColor(java.awt.Color color)
          Sets the current color.
 void setShadeModel(int shadeModel)
          Sets the shade model.
 void unsetColor()
          Unsets the current color.
 void unsetShadeModel()
          Unsets the shade model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorState

public ColorState()
Constructs color state.

Method Detail

hasColor

public boolean hasColor()
Determines whether current color is set.

Returns:
true, if set; false, otherwise.

getColor

public java.awt.Color getColor()
Gets the current color.

Returns:
the current color.

setColor

public void setColor(java.awt.Color color)
Sets the current color.

Parameters:
color - the current color.

unsetColor

public void unsetColor()
Unsets the current color.


hasShadeModel

public boolean hasShadeModel()
Determines whether shade model is set.

Returns:
true, if set; false, otherwise.

getShadeModel

public int getShadeModel()
Gets the shade model.

Returns:
the shade model.

setShadeModel

public void setShadeModel(int shadeModel)
Sets the shade model.

Parameters:
shadeModel - the shade model.

unsetShadeModel

public void unsetShadeModel()
Unsets the shade model.


apply

public void apply()
Description copied from interface: State
Applies this OpenGL state. This method makes OpenGL state consistent with any attribute fields in this state that are currently set.

Specified by:
apply in interface State

getAttributeBits

public int getAttributeBits()
Description copied from interface: State
Gets the OpenGL attribute bits for this state. These bits indicate what OpenGL state is changed by the method State.apply(). If these bits are passed to glPushAttrib before calling State.apply(), then glPopAttrib will restore any OpenGL state that is changed by that method.

Specified by:
getAttributeBits in interface State