FT800 Series Programmer Guide
Version 2.1
Document Reference No.: BRT_000030 Clearance No.: BRT#037
135
Copyright © Bridgetek Limited
4.38
STENCIL_FUNC
Set function and reference value for stencil testing
Encoding
31 24
23 20
19 16
15 8
7 0
0x0A
Reserved
func
ref
mask
Parameters
func
Specifies the test function, one of NEVER, LESS, LEQUAL, GREATER, GEQUAL,
EQUAL, NOTEQUAL, or ALWAYS. The initial value is ALWAYS. About the value
of these constants, please check Figure 8: The constants of ALPHA_FUNC
ref
Specifies the reference value for the stencil test. The initial value is 0
mask
Specifies a mask that is ANDed with the reference value and the stored stencil
value. The initial value is 255
Description
Stencil test rejects or accepts pixels depending on the result of the test function
defined in func parameter, which operates on the current value in the stencil buffer
against the reference value.
Examples
Draw two points, incrementing stencil at each pixel, then draw the pixels with value
2 in red:
dl( STENCIL_OP(INCR, INCR) );
dl( POINT_SIZE(760) );
dl( BEGIN(POINTS) );
dl( VERTEX2II(50, 60, 0, 0) );
dl( VERTEX2II(110, 60, 0, 0) );
dl( STENCIL_FUNC(EQUAL, 2, 255) );
dl( COLOR_RGB(100, 0, 0) );
dl( VERTEX2II(80, 60, 0, 0) );
Graphics context
The values of func, ref and mask are part of the graphics context, as described in
section 4.1
See also