2013年11月12日 星期二

halo effect and stencil buffer



         glEnable(GL_STENCIL_TEST);

         glStencilFunc(GL_ALWAYS, 1, 0xFF); // Set any stencil to 1
         glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
         glStencilMask(0xFF); // Write to stencil buffer
         glDepthMask(GL_FALSE); // Don't write to depth buffer
         glClear(GL_STENCIL_BUFFER_BIT); // Clear stencil buffer (0 by default)
glDisable(GL_BLEND);

//draw原來物件

         glStencilFunc(GL_EQUAL, 0, 0xFF); // Pass test if stencil value is 1
         glStencilOp(GL_KEEP,GL_KEEP,GL_KEEP);      
         glStencilMask(0x00); // Don't write anything to stencil buffer

glEnable(GL_BLEND);
//draw halo object
         glDepthMask(GL_TRUE);







沒有留言:

張貼留言