PDA

View Full Version : Stencil Buffer values



DarthPaul
10-21-2003, 10:26 AM
If the stencil test passes in the following stencil function what value is written to the stencil buffer 4 or 0?




glStencilFunc(GL_NOTEQUAL,0x4,0x1);
glStencilOp(GL_KEEP,GL_REPLACE,GL_REPLACE);


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

ioquan
10-21-2003, 02:56 PM
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.

DarthPaul
10-21-2003, 03:08 PM
Thanks, ioquan.

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

ioquan
10-21-2003, 03:30 PM
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).]

DarthPaul
10-22-2003, 05:46 AM
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.

ioquan
10-23-2003, 07:16 PM
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.