PDA

View Full Version : multiple glStencilFunc



bocos
04-01-2008, 07:56 PM
Hi, guys.

I have a question about using glStencilFunc multiple times and drawing primitives. For example,


glStencilFunc(GL_EQUAL, 0x4, 0x4);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);

glStencilFunc(GL_NEVER, 0x0, 0x0);
glStencilOp(GL_INVERT, GL_INVERT, GL_INVERT);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);

glColor3f (1.0f, 1.0f, 0.0f);

glBegin(GL_QUADS);
glVertex2f(-0.75f, -0.25f);
glVertex2f(0.75f, -0.25f);
glVertex2f(0.75f, 0.25f);
glVertex2f(-0.75f, 0.25f);
glEnd();


What is happening from the codes?? Are the previous glStencilFunc and glStencilOp working?

Thanks.

Komat
04-02-2008, 01:17 AM
Only parameters from the last call to function are applied so in your case the primitive will be rendered with the



glStencilFunc(GL_NEVER, 0x0, 0x0);
glStencilOp(GL_INVERT, GL_INVERT, GL_INVERT);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);

state.