PDA

View Full Version : waht's the "Stencil Test" Compare



sosozcm
02-14-2011, 02:00 AM
void StencilFunc( enum func, int ref, uint mask )
The stencil test conditionally discards a fragment based on the outcome of a comparison
between the value in the stencil buffer at location (xw, yw) and a referencevalue.
So i don't understand what's the value in the stencil buffer stand for. the value of RGBA?or something else?
for depth test, it is clear that the value of Z coordinate is compared.

yoyonel
02-14-2011, 04:15 AM
Wikipedia is your friend:
"A stencil buffer is an EXTRA BUFFER, in addition to the color buffer (pixel buffer) and depth buffer (z-buffering) ..."
=> http://en.wikipedia.org/wiki/Stencil_buffer
Stencil buffer is a integer buffer, and it's use for binary test like: equal, less, more, notequal, etc ...
"the stencil buffer is used to limit the area of rendering (stenciling)"

YoYoOoOoOOoo

ZbuffeR
02-14-2011, 04:19 AM
No, the stencil buffer is another data buffer, similar to color (rgba) and depth, but separate.
Typically 8 bits. Can be used to draw masks for example. Mandatory to use stencil shadows (less useful now).

Maybe this page can help you understand better the stencil buffer and its possibilities :
http://psysal.livejournal.com/67933.html


EDIT: yoyonel was faster