Skip to main content
gamedev.net
🔒 Locked

Stencil buffer

Started by Dr_Freeman Apr 30, 2007 at 8:53 AM 0 replies 800+ views
Original Post
Dr_Freeman
Dr_Freeman
Hi everyone! Can anybody help me with a stencil buffer ? I need to subtract some contour (a group of points) from a surface (just a plane). But I don't understand the meaning of glStencilFunc's parameters. Can anybody tell me what are they means ? =) Please help me to solve my problem or just give me a simple example how to do this.
V-man
V-man
when you render the points,
glStencilMask(0xFFFFFFFF);
glStencilFunc(GL_ALWAYS, 0, 0xFFFFFFFF);
glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);

so the stencil will be filled with 1 or more when you render your points

Then when you render your other polygon

You need to use all the stencil functions

glStencilMask(0xFFFFFFFF);
glStencilFunc(GL_NOTEQUAL, 0, 0xFFFFFFFF);
glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);

Check the glspec if you want to know what each parameter does.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.