Пример #1
0
TextureLoader::TextureLoader(char* location, Texture_Type type) :_type(type)
{
	if (_type == TX_TEXTURE)
		loadTexture(location);

	if (_type == TX_SKYBOX)
		loadSkybox();
}
Пример #2
0
//Initialisation function.
void init(int argc, char **argv) {
  //Initialise GLUT.
  glutInit(&argc, argv);

  // Use doule buffering.
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
  glutInitWindowSize(760, 760);

  //Create window.
  glutCreateWindow("Come Fly With Me - by Chris Patuzzo");

  //Set up camera.
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluPerspective(90, 1, 0.00001, 1 / SCALE_FACTOR);
  glMatrixMode(GL_MODELVIEW);

  //Set the clear color.
  glClearColor(0, 0, 0, 1);

  //Use z-buffer, lighting, normal scaling.
  glEnable(GL_DEPTH_TEST);

  //Set up two lights; the sun and its reflection.
  setupLights();

  //Use vertex arrays.
  glEnableClientState(GL_VERTEX_ARRAY);
  glEnable(GL_TEXTURE_2D);

  //Load skybox and objects.
  loadSkybox();
  loadObjects();

  //Calculate cloud plane.
  calculateCloudPlane();
}