Pastafarianist

OpenGL Lights

Jul 29th, 2012
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.73 KB | None | 0 0
  1. procedure setupLighting;
  2.   const light_position: array [0..3] of GLFloat = (0.0, 0.0, -scene_distance, 1.0);
  3.         light_direction: array [0..2] of GLFloat = (0.0, 0.0, -1.0);
  4.         light_color: array [0..3] of GLFloat = (0.5, 0.5, 0.5, 1.0);
  5.         light_cutoff: array [0..0] of GLFloat = (180.0);
  6.         light_exponent: array [0..0] of GLFloat = (50.0);
  7. begin
  8.   glEnable(GL_LIGHTING);
  9.   glEnable(GL_LIGHT0);
  10.  
  11.   glLightfv(GL_LIGHT0, GL_POSITION, light_position);
  12.   glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, light_direction);
  13.   glLightfv(GL_LIGHT0, GL_SPOT_CUTOFF, light_cutoff);
  14.   glLightfv(GL_LIGHT0, GL_SPOT_EXPONENT, light_exponent);
  15.   glLightfv(GL_LIGHT0, GL_SPECULAR, light_color);
  16.  
  17.   glEnable(GL_COLOR_MATERIAL);
  18. end;
Add Comment
Please, Sign In to add comment