why are you implementing the PROGRAM as a UNIT? (what's the program's text, btw?)
i wonder if it's a bug in FPC, that allows begin..end. in unit declaration (or is it some macpascal compat feature?!)
here's code of the program, it runs fine (see the screenshot). Hope it works for you, let us know about the results. Thanks.
program Project1;
{$mode objfpc}{$H+}
uses
Classes, SysUtils, glu, glut, gl;
procedure square;
begin
glBegin(GL_QUADS); //begin the four sided shape
glVertex3f(-0.5, -0.5, 0.0); //first corner at -0.5, -0.5
glVertex3f(-0.5, 0.5, 0.0); //second corner at -0.5, 0.5
glVertex3f(0.5, 0.5, 0.0); //third corner at 0.5, 0.5
glVertex3f(0.5, -0.5, 0.0); //fourth corner at 0.5, -0.5
glEnd(); //end the shape we are currently working on
end;
procedure display;cdecl;
begin
glClearColor (0.0,0.0,0.0,1.0); //clear the color of the window
glClear (GL_COLOR_BUFFER_BIT); //Clear teh Color Buffer (more buffers later on)
glLoadIdentity(); //load the Identity Matrix
//gluLookAt (0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); //set the view
square;
glFlush(); //flush it all to the screen
end;
begin
glutInit(@argc, argv);
glutInitDisplayMode(GLUT_SINGLE);
glutInitWindowSize(800,600);
glutInitWindowPosition (100, 100);
glutCreateWindow('Example');
glutDisplayFunc(@display);
glutMainLoop;
end.