void control_cb(int control) { switch (control) { case DEPTH_TEXT_ID: glDeleteLists(list,1); depth = depth_text->get_int_val(); printf("DEPTH = %d. Computing the scene... ",depth); list = glGenLists(1); glNewList(list, GL_COMPILE_AND_EXECUTE); drawScene(); flushCanvas(); glEndList(); printf("Done\n"); glFlush(); break; case EXIT_ID: exit(0); break; default: break; } }
void display() { glClear(GL_COLOR_BUFFER_BIT); drawScene(::nColorFilter); // draws the picture in the canvas flushCanvas(); // draw the canvas to the OpenGL window glFlush(); }
void init(int w, int h) { /* OpenGL setup */ glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0); glClearColor(0.0, 0.0, 0.0, 0.0); /* low-level graphics setup */ initCanvas(w,h); /* raytracer setup */ initCamera(w,h); initScene(); initLight(); printf("DEPTH = %d. Computing the scene... ",depth); list = glGenLists(1); glNewList(list, GL_COMPILE); drawScene(); flushCanvas(); glEndList(); printf("Done\n"); }