GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


New Paste :: Recent Pastes:: No Line Numbers


A Paste by Anonymous
1
 
void lights(void)
{
  GLfloat position[] =  {sun_x, sun_y, sun_z, 1.0};
  GLfloat position1[] = {0, 5, -10, 1.0};
  GLfloat light_ambient[] = {0.1, 0.1, 0.1, 1.0};
  GLfloat light_diffuse[] = {0.7, 0.7, 0.7, 1.0};

  glEnable(GL_LIGHTING);
  glEnable(GL_LIGHT0);
  glEnable(GL_LIGHT1);
  glEnable(GL_NORMALIZE);
  glDepthFunc(GL_LESS);
  glEnable(GL_DEPTH_TEST);                            // Enables Depth Testing

  glPushMatrix();
  glTranslatef(sun_x, sun_y, sun_z);
  glLightfv(GL_LIGHT0, GL_POSITION, position);
  glDisable(GL_LIGHTING);
  glColor3f(1.0, 1.0, 0.0);
  glutSolidSphere(7.5, 20.0, 20.0);
  glEnable(GL_LIGHTING);
  glPopMatrix();

  glPushMatrix();
  glTranslatef(0, 2, 10);
  //glutWireSphere(1.5, 20.0, 20.0);
  glLightfv(GL_LIGHT1, GL_POSITION, position1);
  glPopMatrix();
}