void go() { int view_pass; glClear(GL_ACCUM_BUFFER_BIT); for(view_pass=0;view_pass<VPASSES;view_pass++){ jitter_view(); draw_stuff(); glFlush(); glAccum(GL_ACCUM,1.0/(float)(VPASSES)); } glAccum(GL_RETURN,1.0); }
//AntiAliasing routine void draw_AA() { int view_pass; point reverseJitter; glClear(GL_ACCUM_BUFFER_BIT); for(view_pass=0; view_pass < AA_PASSES; view_pass++){ //Jitter translates the modelview by a tiny amount. ReverseJitter will be used to translate the modelview back to its original position //after the jittered image is recorded in the accumulation buffer reverseJitter = jitter_view(); //draw to dynamic cubemap // drawCubeMap(reverseJitter); draw_stuff(); glAccum(GL_ACCUM,1.0/(float)(AA_PASSES)); glTranslatef(-reverseJitter.x,-reverseJitter.y,-reverseJitter.z); } glAccum(GL_RETURN,1.0); glutSwapBuffers(); }
int main(int argc, char **argv) { srandom(123456789); glutInit(&argc,argv); glutInitDisplayMode(GLUT_RGBA|GLUT_DEPTH|GLUT_ACCUM); glutInitDisplayMode(GLUT_RGBA|GLUT_DEPTH); glutInitWindowSize(768,768); glutInitWindowPosition(100,50); glutCreateWindow("my_cool_cube"); glClearColor(0.35,0.35,0.35,0.0); glClearAccum(0.0,0.0,0.0,0.0); glEnable(GL_DEPTH_TEST); viewvolume_shape(); jitter_view(); do_lights(); do_material(); glutDisplayFunc(go); glutKeyboardFunc(getout); glutMainLoop(); return 0; }