public final class RenderState

  1. Object
  2. RenderState
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 types

enum RenderState.BlendModeThe alpha blending mode applied when a fragment is written.
enum RenderState.CullModeWhich triangle faces are discarded before rasterization.

Constructors

public RenderState()

Methods

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

Inherited methods

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 boolean
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 boolean
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 RenderState.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 RenderState.CullMode
the cull mode

Returns

this state for chaining