Example #1
0
int main(int argc, char** argv)
{
	glutInit(&argc, argv);
	//change mode here.
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
	glutInitWindowSize(w_width, w_height);
	glutCreateWindow("GPU Path Tracer");//GPU Photon Mapping


	if(CUTFalse == initGL())
		return 0;
	if(CUTFalse == initCUDA(argc, argv))
		return 0;
	//call self defined init function
	initCUDAMemory();

	//create scene / world here.
	createWorld();
	//upload world scene to device.
	uploadToGPU();

	//Event
	glutMouseFunc((GLUTmousebuttonfun)TwEventMouseButtonGLUT);
	glutMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT);
	glutPassiveMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT);

	glutDisplayFunc(display);
	glutReshapeFunc(reshape);
	glutKeyboardFunc(keypress);
	glutIdleFunc(display);


	srand(time(NULL));
	glutMainLoop();
	return 0;
}
Example #2
0
void Renderer::init() {
  fullScreenQuad.begin();
  initPBO();
  initCUDAMemory();
}