コード例 #1
0
ファイル: raytrace.cpp プロジェクト: nickolashe/projects
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;
	}
}
コード例 #2
0
ファイル: main.cpp プロジェクト: afable/ray_tracer
void display()
{
	glClear(GL_COLOR_BUFFER_BIT);
	drawScene(::nColorFilter);  // draws the picture in the canvas
	flushCanvas();  // draw the canvas to the OpenGL window
	glFlush();
}
コード例 #3
0
ファイル: raytrace.cpp プロジェクト: nickolashe/projects
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");
}