?????????
??????????glGetInteger????????????????????

#include "header.h"
float dRadius =0;
float dAngel;
float aspect=0;
void init()
{
glClearColor(0??0??1.0??0);
glClearStencil(0);
glClearDepth(1.0f);
glEnable(GL_STENCIL_TEST);
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
glLoadIdentity();
glTranslatef(0?? 0?? -20);
////glStencilFunc(GL_ALWAYS?? 0??0x00);
glStencilFunc(GL_NEVER??0x0??0xFF);
glStencilOp(GL_INCR??GL_INCR??GL_INCR);
glColor3f(1.0f??1.0f??1.0f);
dRadius = 5.0*(sqrt(2.0)/2.0);
glBegin(GL_LINE_STRIP);
for (dAngel=0;dAngel<380.0;dAngel+=0.1)
{
glVertex2d(dRadius*cos(dAngel)??dRadius*sin(dAngel));
dRadius*=1.003;
}
glEnd();
glStencilFunc(GL_NOTEQUAL??0x1??0xFF);
glStencilOp(GL_INCR??GL_INCR??GL_INCR);//
glColor3f(1.0f??0.0f??0.0f);
glRectf(-5??-5??5??5);
glutSwapBuffers();
}
void reshape(int w?? int h)
{
glViewport(0??0??w??h);
aspect = (w*1.0)/h;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60?? aspect?? 1?? 100);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
int main(int argc?? char** argv)
{
glutInit(&argc?? argv);
//glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGBA|GLUT_STENCIL);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGBA|GLUT_STENCIL|GLUT_DEPTH);
glutInitWindowPosition(200??200);
glutInitWindowSize(600??600);
glutCreateWindow("??建????????????");
glewInit();
init();
glutReshapeFunc(reshape);
glutDisplayFunc(display);
glutMainLoop();
return 0;
}