Back to Filament

setStencilBufferEnabled

docs/android/dokka/filament-android/com.google.android.filament/-view/set-stencil-buffer-enabled.md

1.75.01.3 KB
Original Source

//filament-android/com.google.android.filament/View/setStencilBufferEnabled

setStencilBufferEnabled

[main]
open fun setStencilBufferEnabled(enabled: Boolean)

Enables use of the stencil buffer.

The stencil buffer is an 8-bit, per-fragment unsigned integer stored alongside the depth buffer. The stencil buffer is cleared at the beginning of a frame and discarded after the color pass.

Each fragment's stencil value is set during rasterization by specifying stencil operations on a Material. The stencil buffer can be used as a mask for later rendering by setting a Material's stencil comparison function and reference value. Fragments that don't pass the stencil test are then discarded.

If post-processing is disabled, then the SwapChain must have the CONFIG_HAS_STENCIL_BUFFER flag set in order to use the stencil buffer.

A renderable's priority (see setPriority) is useful to control the order in which primitives are drawn.

Parameters

main

enabledTrue to enable the stencil buffer, false disables it (default)