示例#1
0
void Init(){

	glClearColor(0.5, 0.5, 0.5, 1);
	glClearDepth(1);
	glEnable(GL_DEPTH_TEST);

	for (size_t i = 0; i < 256; i++)
	{
		vecSpecialKeyPressed[i] = false;
		vecKeyPressed[i] = false;
	}

	initShaders();

	initTextures();

	initMouseMovements();

	initVectors();

	initCubeMap();

	initTerrain();

	initVegetation();

	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

	GLint MaxPatchVertices = 0;
	glGetIntegerv(GL_MAX_PATCH_VERTICES, &MaxPatchVertices);
	printf("Max supported patch vertices %d\n", MaxPatchVertices);
}
示例#2
0
int main(int argc, char **argv) 
{
	std::string fileName(argv[1]);
	primaryOBJ = new model(fileName, verticesPerFace);

	//setup glut window
	setupGlut(argc, argv);

	//setup the projection and view matrices
	initViewport();
	//initialize the cube map textures that will form our skybox
	initCubeMap();

	// initialize the fbo for dynamic cubemapping
	//initDynamicCubeMap();
	// standard light initialization.  Relatively unchanged from the Bunny project
	create_lights();
	//standard material initialization.  Relatively unchanged from the Bunny project
	create_material();
	teapotShader = set_shaders((char *)"phongEC");
	planeShader = set_shaders((char *)"plane");

	// This will read in the texture that will be applied to the teapot, if a texture is applied to the teapot at all
	// initTeapotTexture((char*)"textures/bubble_color.ppm");
	initCircleTexture((char*)"textures/circle.tga");
	// setting up the main shader for the teapot
	defaultShader = set_shaders((char*)"phongEC");
	// setting up the shader for the skybox / cube map
	skyboxShader = set_shaders((char*)"skybox");
	// set up the skybox geometry cube
	initSkyboxGeometry();

	// Main loop functions
	glutDisplayFunc(draw_AA);
	glutKeyboardFunc(keyBindings);
	glutSpecialFunc(translateCam);

	glutMainLoop();
	return 0;
}