lowgl-0.3.1.0: Basic gl wrapper and reference

Safe HaskellNone
LanguageHaskell2010

Graphics.GL.Low.Stencil

Synopsis

Documentation

The stencil test is like a configurable depth test with a dedicated additional buffer. Like the depth test, if the stencil test fails then the pixel being tested will not be rendered. The stencil test happens before the depth test, if it's enabled. For a given pixel, the stencil test passes if the following computation

(ref & mask) `stencilOp` (buf & mask)

computes true. The variables ref and mask are configurable constants, buf is the value in the stencil buffer at the given pixel, and stencilOp is a configurable comparison operation. The stencil op can also be set to pass Always or Never.

The stencil buffer may be modified in various ways on the following events:

  • When the stencil test fails or
  • When the stencil test passes then the depth test fails or
  • When both tests pass.

enableStencil :: Stencil -> IO () Source

Enable the stencil test with a set of operating parameters.

disableStencil :: IO () Source

Disable the stencil test and updates to the stencil buffer, if one exists.

clearStencilBuffer :: IO () Source

Clear the stencil buffer with all zeros.

basicStencil :: Stencil Source

In this basic configuration of the stencil, anything rendered will create a silhouette of 1s in the stencil buffer. Attempting to render a second time into the silhouette will have no effect because the stencil test will fail (ref=1 isn't greater than buffer=1).

def { func = Greater
    , ref = 1
    , onBothPass = Replace }

data Stencil Source

Configuration of the stencil test and associated stencil buffer updating.

Instances

Default Stencil

The default state of the stencil, if it were simply enabled, would be to always pass and update nothing in the buffer. It would have no effect on rendering.

data StencilFunc Source

The stencil test passes under what condition.

data StencilOp Source

Modification action for the stencil buffer.

Constructors

Keep

Do nothing.

Zero

Set to zero.

Replace

Write the ref value passed to enableStencil.

Increment 
Decrement 
Invert

Bitwise complement.

IncrementWrap 
DecrementWrap