# Class RenderState

java.lang.Object
com.codename1.gpu.RenderState

public final class RenderState extends Object
Fixed function pipeline state attached to a `Material`: depth testing, alpha blending and face culling. Sensible defaults are provided for opaque 3D geometry (depth test and write on, no blending, back faces culled).

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `RenderState.BlendMode`
  The alpha blending mode applied when a fragment is written.
  `static enum`
  `RenderState.CullMode`
  Which triangle faces are discarded before rasterization.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `RenderState()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `RenderState.BlendMode`
  `getBlendMode()`
  Returns the configured blend mode.
  `RenderState.CullMode`
  `getCullMode()`
  Returns the configured cull mode.
  `boolean`
  `isDepthTest()`
  Returns true if depth testing is enabled.
  `boolean`
  `isDepthWrite()`
  Returns true if writing to the depth buffer is enabled.
  `static RenderState`
  `opaque()`
  Returns a render state suitable for opaque geometry.
  `RenderState`
  `setBlendMode(RenderState.BlendMode blendMode)`
  Sets the blend mode.
  `RenderState`
  `setCullMode(RenderState.CullMode cullMode)`
  Sets the face culling mode.
  `RenderState`
  `setDepthTest(boolean depthTest)`
  Enables or disables depth testing.
  `RenderState`
  `setDepthWrite(boolean depthWrite)`
  Enables or disables writing to the depth buffer.
  `static RenderState`
  `transparent()`
  Returns a render state suitable for alpha blended, non depth writing transparent geometry.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### RenderState

    public RenderState()

- ## Method Details

  - ### opaque

    public static RenderState opaque()
    Returns a render state suitable for opaque geometry.

  - ### transparent

    public static RenderState transparent()
    Returns a render state suitable for alpha blended, non depth writing transparent geometry.

  - ### isDepthTest

    public boolean isDepthTest()
    Returns true if depth testing is enabled.

  - ### setDepthTest

    public RenderState setDepthTest(boolean depthTest)

    Enables or disables depth testing.

    ###### Parameters

    - `depthTest`: true to enable depth testing

    ###### Returns

    this state for chaining

  - ### isDepthWrite

    public boolean isDepthWrite()
    Returns true if writing to the depth buffer is enabled.

  - ### setDepthWrite

    public RenderState setDepthWrite(boolean depthWrite)

    Enables or disables writing to the depth buffer.

    ###### Parameters

    - `depthWrite`: true to write depth values

    ###### Returns

    this state for chaining

  - ### getBlendMode

    public RenderState.BlendMode getBlendMode()
    Returns the configured blend mode.

  - ### setBlendMode

    public RenderState setBlendMode(RenderState.BlendMode blendMode)

    Sets the blend mode.

    ###### Parameters

    - `blendMode`: the blend mode

    ###### Returns

    this state for chaining

  - ### getCullMode

    public RenderState.CullMode getCullMode()
    Returns the configured cull mode.

  - ### setCullMode

    public RenderState setCullMode(RenderState.CullMode cullMode)

    Sets the face culling mode.

    ###### Parameters

    - `cullMode`: the cull mode

    ###### Returns

    this state for chaining