unit lights;

interface
 procedure SetLightOptionsOnInit();

implementation

uses dglopengl;

procedure SetLightOptionsOnInit();
 const material_specular : Array[0..3] of GLfloat = (0, 0, 0, 1);
       material_shininess: Array[0..0] of GLfloat = (20);
       material_ambient  : Array[0..3] of GLfloat = (0.5, 0.5, 0.5, 1);
       material_diffuse  : Array[0..3] of GLfloat = (0.5, 0.5, 0.5, 1);

       light_position    : Array[0..3] of GLfloat = (0, 0, 0, 1);
       light_ambient     : Array[0..3] of GLfloat = (0.5, 0.5, 0.5, 1);
       light_diffuse     : Array[0..3] of GLfloat = (1, 0, 0, 1);
       light_specular    : Array[0..3] of GLfloat = (1, 1, 1, 1);

begin
 glEnable(GL_LIGHTING);
 glEnable(GL_LIGHT0);

 glMaterialfv(GL_FRONT, GL_SPECULAR, @material_specular[0]);
 glMaterialfv(GL_FRONT, GL_SHININESS, @material_shininess[0]);
 glMaterialfv(GL_FRONT, GL_AMBIENT, @material_ambient[0]);
 glMaterialfv(GL_FRONT, GL_DIFFUSE, @material_diffuse[0]);

 glLightfv(GL_LIGHT0, GL_POSITION, @light_position[0]);
 glLightfv(GL_LIGHT0, GL_AMBIENT, @light_ambient[0]);
 glLightfv(GL_LIGHT0, GL_DIFFUSE, @light_diffuse[0]);
 glLightfv(GL_LIGHT0, GL_SPECULAR, @light_specular[0]);
end;

end.
