Stencil Buffer values

If the stencil test passes in the following stencil function what value is written to the stencil buffer 4 or 0?


4 right? because the mask just affects the comparison between the present stencil buffer value.

The value is 4 because you have your stencil op for when the stencil test passes set to GL_REPLACE. GL_REPLACE simply replaces the current value in the stencil buffer with the reference value.

Thanks, ioquan.

I have another question that I posted in the advanced forum and no one has given me feedback, perhaps you could.

I saw your question there but wasnt sure what you were trying to ask. Can you restate/simplify your question?

edit: I looked at the link to the .txt file. That is using the two sided stencil extension. Is there a reason why you want to use the two sided stencil extension?

[This message has been edited by ioquan (edited 10-21-2003).]

I wasn’t looking into using the two sided stencil extension. I was just trying to understand how to set the stencil values. So I followed the logic and it didn’t work like it said it should work. Hope that makes sense.

Basically, I found an error in the documentation and I wanted to share and make sure I was not wrong.

No, you didnt find an error. You found documentation on the two sided stencil, and expected to operate the same way as normal one sided stenciling.