Name
glClearStencil
- specify the clear value for the stencil bufferC Specification
void glClearStencil(GLint s)
Parameters
s
- Specifies the index used when the stencil buffer is cleared. The initial value is 0.
Description
glClearStencil
specifies the index used by glClear
to clear the stencil buffer. s
is masked with 2m - 1, where m is the number of bits in the stencil buffer.Associated Gets
glGetInteger
with argument GL_STENCIL_BITS
Copyright
Copyright © 2003 Silicon Graphics, Inc.This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/.
See Also
glClear
, glClearColor
, glClearDepth
, glGetInteger
, glStencilFunc
, glStencilOp
, glStencilMask
Example of glClearStencil
void RenderScence(void)
{
GLdouble dRadius = 0.1;
GLdouble dAngle;
glClearColor(0.0f,0.0f,1.0f,0.0f);
glClearStencil(0.0f);
glEnable(GL_STENCIL_TEST);
glClear(GL_COLOR_BUFFER | GL_STENCIL_BUFFER_BIT);
glStencilFunc(GL_NEVER,0x0,0x0);
glStencilOp(GL_INCR , GL_INCR , GL_INCR);
glColor3f(1.0f,1.0f,1.0f);
glBegin(GL_LINE_STRIP);
for( dAngle = 0 ; dAngle < 400 ; dAngle += 0.1)
{
glVertex2d( dRadius * cos(dAngle) , dRadius * sin( dAngle));
dRadius *= 1.002;
}
glEnd();
glStencilFunc(GL_NOTEQUAL , 0x1, 0x1 );
glStencilOp(GL_KEEP,GL_KEEP,GL_KEEP);
glColor3f(1.0f,0.0f,0.0f);
glRectf(x,y, x + rsize, y - rsize);
glSwapBuffer();
}