void Renderer::paintGL()
{
	glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
	
	glLoadIdentity();
	
	// Apply global transformations
	gluLookAt(eye[0], eye[1], eye[2],       // Eye
		look_at[0], look_at[1], look_at[2], // "Look at" position
		0.0, 1.0, 0.0 );                    // Up vector
	  
	// Reposition lights after view transformation if you want their position in
	// world coordinates to stay the same
	//glEnable(GL_LIGHTING);
	glLightfv(GL_LIGHT0, GL_POSITION, light0pos);
	glLightfv(GL_LIGHT1, GL_POSITION, light1pos);
	glLightfv(GL_LIGHT2, GL_POSITION, light2pos);
  
	// Draw stuff
	// 
	// For lighting to work, you must give each face/vertex
	// a normal.
	
	glFlush();

}

void Renderer::initializeGL()
{     
	// When debugging lighting, it is best to use 
	// a clear color other than black
	glClearColor(1.0, 1.0, 1.0, 0.0);
	
	GLfloat light0pos[4], light1pos[4],light2pos[4];
	// Set up lighting 
	light0pos[0] = 0.0; light0pos[1] = 0.0;     // x, y
	light0pos[2] = 2.0; light0pos[3] = 0.0;     // z, spotlight = false
	light1pos[0] = -3.0; light1pos[1] = 3.0;    // x, y
	light1pos[2] = -3.0; light1pos[3] = 0.0;     // z, spotlight = false
	light2pos[0] = 3.0; light2pos[1] = -3.0;    // x, y
	light2pos[2] = -3.0; light2pos[3] = 0.0;     // z, spotlight = false
	GLfloat whitelight[] = {1.0, 1.0, 1.0, 1.0}; 
	GLfloat spec[] = {0.4, 0.4, 0.4, 1.0};
	GLfloat ambient[] = {0.3, 0.3, 0.3, 1.0};
	
	glShadeModel( GL_SMOOTH );
	glLightfv(GL_LIGHT0, GL_DIFFUSE, whitelight);
	glLightfv(GL_LIGHT0, GL_SPECULAR, spec);
	glLightfv(GL_LIGHT0, GL_POSITION, light0pos);
	glLightfv(GL_LIGHT1, GL_DIFFUSE, whitelight);
	glLightfv(GL_LIGHT1, GL_SPECULAR, spec);
	glLightfv(GL_LIGHT1, GL_POSITION, light1pos);
	glLightfv(GL_LIGHT2, GL_DIFFUSE, whitelight);
	glLightfv(GL_LIGHT2, GL_SPECULAR, spec);
	glLightfv(GL_LIGHT2, GL_POSITION, light2pos);
	glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient);
	
	// Enable all the necessary features
	glEnable(GL_LIGHTING);
	glEnable(GL_LIGHT0);
	glEnable(GL_LIGHT1);
	glEnable(GL_LIGHT2);
	glEnable(GL_DEPTH_TEST);
}

