PDA

View Full Version : ATI_separate_stencil



Frenz
08-01-2003, 09:42 AM
Anyone has a working example using this extension??

Thanks http://www.opengl.org/discussion_boards/ubb/smile.gif

Eric Lengyel
08-02-2003, 01:54 PM
From The OpenGL Extensions Guide (http://www.terathon.com/books/extensions.html) :

The following code shows how a stencil shadow volume might be rendered using the GL_ATI_separate_stencil extension. Stencil operations are specified for both front-facing and back-facing polygons, and a single rendering pass is made. The RenderShadowVolume() function makes whatever calls are needed to render the shadow volume geometry.




glDisable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
glEnable(GL_STENCIL_TEST);

// Disable writes to color and depth buffers
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
glDepthMask(GL_FALSE);

glStencilMask(~0);
glStencilFunc(GL_ALWAYS, 0, ~0);

// Set front-facing stencil state
glStencilOpSeparateATI(GL_FRONT, GL_KEEP,
GL_KEEP, GL_INCR_WRAP_EXT);

// Set back-facing stencil state
glStencilOpSeparateATI(GL_BACK, GL_KEEP,
GL_KEEP, GL_DECR_WRAP_EXT);

// Perform single rendering pass
RenderShadowVolume();

Frenz
08-03-2003, 02:02 PM
Thanks :-)