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:: Add Line Numbers


A Paste by Anonymous
void lights(void)
{
  GLfloat position[] =  {sun_x, sun_y, sun_z, 1.0};

  glEnable(GL_LIGHTING);
  glEnable(GL_LIGHT0);
  glEnable(GL_NORMALIZE);
  glDepthFunc(GL_LESS);
  glEnable(GL_DEPTH_TEST);                            // Enables Depth Testing
  glLightfv(GL_LIGHT0, GL_POSITION, position);
  glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
  glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 80.0);
  glTranslatef(sun_x, sun_y, sun_z);
  glDisable(GL_LIGHTING);
  glColor3f(1.0, 1.0, 0.0);

  glutSolidSphere(7.5, 20.0, 20.0);
  glEnable(GL_LIGHTING);
}