1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
with GL; use GL;
with GLU; use GLU;
with Glut; use Glut;
with GNAT.OS_Lib;
package body ada_sphere_procs is
procedure display is
begin
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
glutSolidSphere(1.0, 10, 10);
glutSwapBuffers;
end display;
procedure reshape(w : Integer; h : Integer) is
begin
glViewport(0, 0, GLsizei(w), GLsizei(h));
end reshape;
procedure menu (value : Integer) is
begin
if (value = 666) then
GNAT.OS_Lib.OS_Exit (0);
end if;
end menu;
procedure init is
light_diffuse : array(0 .. 3) of aliased GLfloat :=
(1.0, 0.0, 0.0, 1.0);
light_position : array(0 .. 3) of aliased GLfloat :=
(1.0, 1.0, 1.0, 0.0);
begin
glClearColor(0.1, 0.1, 0.1, 0.0);
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse(0)'access);
glLightfv(GL_LIGHT0, GL_POSITION, light_position(0)'access);
glFrontFace(GL_CW);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glMatrixMode(GL_PROJECTION);
gluPerspective(40.0, 1.0, 1.0, 10.0);
glMatrixMode(GL_MODELVIEW);
gluLookAt(
0.0, 0.0, -5.0,
0.0, 0.0, 0.0,
0.0, 1.0, 0.0);
end init;
end ada_sphere_procs;
|