- procedure CreateLight;
- const
- //position des lichtes
- light_position : Array[0..3] of TGlFloat = (1.0, 1.0, -9.0, 1.0);
- //Umgebungs Licht
- light0_ambient : Array[0..3] of TGlFloat = (0.0, 0.0, 0.0, 1.0);
- //Lichtstrahlen werden in alle Richtungen verteilt
- light0_diffuse : Array[0..3] of TGlFloat = (0, 1.0, 1.0, 1.0);
- var
- LightDirection : Array[0..2] of TGlFloat;
- begin
- //Lichtrichtung
- LightDirection[0] := 1;
- LightDirection[1] := 1;
- LightDirection[2] := 0;
- //gibt die Richtung an, in die das Spotlicht zeigt
- glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, @LightDirection[0]);
- glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 100.0);
- glLightf(GL_LIGHT0, GL_SPOT_EXPONENT, 90.0);
- glLightfv(GL_LIGHT0, GL_AMBIENT, @light0_ambient[0]);
- glLightfv(GL_LIGHT0, GL_DIFFUSE, @light0_diffuse[0]);
- glLightfv(GL_LIGHT0, GL_POSITION, @light_position[0]);
- glEnable(GL_LIGHT0);
- glEnable(GL_LIGHTING);
- end;