Class GraphicsState

java.lang.Object
rosequartz.gfx.GraphicsState

public class GraphicsState extends Object
Represents a State in the Graphics Pipeline. This class can be used to get a copy of the current state of the graphics pipeline, with the current render target, the selected shader program, depth testing settings and more. The state can then be changed and restored. This makes it easy for making APIs where the state needs to be exactly like before, or managing the state in general. This class stores:

 - selected depth testing function
 - depth testing enabled / disabled
 - targeted render target
 - selected shader program
 
  • Method Details

    • get

      public static GraphicsState get()
      Gets the representation of the current state of the graphics pipeline.
      Returns:
      current graphics state
    • getDepthTesting

      public boolean getDepthTesting()
      Gets if depth testing is enabled in this state of the graphics pipeline.
      Returns:
      depth testing function
    • getDepthFunction

      public DepthTestingManager.TestingFunction getDepthFunction()
      Gets the depth testing function used in this state of the graphics pipeline.
      Returns:
      depth testing function
    • getRenderTarget

      public RenderTarget getRenderTarget()
      Gets the render target in this state of the graphics pipeline.
      Returns:
      render target
    • getShaderProgram

      public ShaderProgram getShaderProgram()
      Gets the shader program used in this state of the graphics pipeline.
      Returns:
      shader program
    • restore

      public void restore() throws NotOnGraphicsThreadException
      Replaces the current graphics state with this one.
      Throws:
      NotOnGraphicsThreadException
    • toString

      public String toString()
      Overrides:
      toString in class Object