/* * estimatepi: produce an estimate of pi every display */ #include #include #include #include typedef GLfloat point2[2]; point2 *p,*reds,*greens; int np,npmax; #define NPINC 100000 void display() { int i,nin=0,nout=0; for(i=0;i=1.0) { reds[nout][0]=p[i][0]; reds[nout][1]=p[i][1]; nout++; } else { greens[nin][0]=p[i][0]; greens[nin][1]=p[i][1]; nin++; } } glClear(GL_COLOR_BUFFER_BIT); glColor3f(0.7,0.0,0.0); glBegin(GL_POINTS); for(i=0;i