love.graphics.setStencilState

Available since LÖVE 12.0
This function replaces love.graphics.stencil and love.graphics.setStencilTest.

Low-level function to configure the screen's per-pixel stencil buffer. For a simpler API see love.graphics.setStencilMode.


The geometry drawn after configuring the stencil state can set invisible stencil values of pixels, in addition to affecting pixel colors.

The stencil buffer (which contains those stencil values) can act like a mask / stencil - this function can be used to determine how further rendering is affected by the stencil values in each pixel, via the comparemode parameter.


Note that unlike love.graphics.setStencilMode this function does not prevent subsequent draws from affecting pixel colors, unless love.graphics.setColorMask is used.

Function

Synopsis

love.graphics.setStencilState( action, comparemode, value, readmask, writemask )

Arguments

StencilAction action
Whether and how to modify any stencil values of pixels that are touched by subsequent draws.
CompareMode comparemode
The type of comparison (if any) to make for each pixel.
number value (0)
The value to use when comparing with the stencil value of each pixel, and the new stencil value to use for pixels if the "replace" stencil action is used. Must be an integer between 0 and 255.
number readmask (255)
An 8 bit mask applied to values read from the stencil buffer in subsequent draws.
number writemask (255)
An 8 bit mask applied to values written to the stencil buffer in subsequent draws.

Returns

Nothing.

Function

Disables writing to the stencil buffer and using its values, for subsequent draws.

Synopsis

love.graphics.setStencilState( )

Arguments

None.

Returns

Nothing.

See Also


Other Languages