Browse Source

* Completed GLU and GLUT support
* Some minor fixes (missing "const"s, changed some untyped "var" arguments
to "const" arguments etc.)

sg 25 years ago
parent
commit
e9ee3ce8ae

+ 4 - 1
packages/opengl/build/README

@@ -10,7 +10,10 @@ holds the informations in the read .def file.
 
 c_linuxd.pp
 -----------
-This program creates the Linux units "linux/gl.pp" and "linux/glut.pp".
+This program creates the Linux units "linux/gl.pp" and "linux/glut.pp". It is
+a kind of template processor which reads in the Linux specific .tpl template
+files; at specially marked places within the template file it inserts
+converted data read in from .def files.
 
 
 *.def

+ 28 - 20
packages/opengl/build/c_linuxd.pp

@@ -2,14 +2,17 @@
   $Id$
 
   GL unit creation tool for Linux dynamic version
-  (c) 1999 Sebastian Guenther, [email protected]
+  (c) 1999-2000 Sebastian Guenther, [email protected]
 }
 
+
+program c_linuxd;
+
 {$MODE objfpc}
 {$H+}
 
-program c_linuxd;
 uses SysUtils, Classes, buildgl;
+
 var
   f: Text;
 
@@ -26,7 +29,8 @@ var
   i, j: Integer;
   s: String;
 begin
-  for i := 0 to procs.Count - 1 do begin
+  for i := 0 to procs.Count - 1 do
+  begin
     s := procs.Strings[i];
     j := Pos('//', s);
     if (Length(s) = 0) or ((j > 0) and (Trim(s)[1] = '/')) then
@@ -43,7 +47,8 @@ var
   i, j: Integer;
   s: String;
 begin
-  for i := 0 to procs.Count - 1 do begin
+  for i := 0 to procs.Count - 1 do
+  begin
     s := Trim(procs.Strings[i]);
     j := Pos(':', s);
     s := Trim(Copy(s, 1, j - 1));
@@ -57,7 +62,7 @@ begin
   WriteLn(f);
   WriteLn(f);
   WriteLn(f, '{');
-  WriteLn(f, '  $', 'Log:$');  // needed because _this_ file might be in CVS, too
+  WriteLn(f, '  $', 'Log:$');  // this source file (c_linuxd.pp) is in CVS, too!
   WriteLn(f, '}');
 end;
 
@@ -65,9 +70,8 @@ var
   DefGL, DefGLExt, DefGLU, DefGLX, DefGLUT: TDefReader;
   tpl: Text;
   s: String;
-  j: Integer;
 begin
-  WriteLn('File Generator for OpenGL related Units');
+  WriteLn('Template processor for OpenGL related Units');
 
   // Load definition files
 
@@ -88,9 +92,11 @@ begin
   Rewrite(f);
   Assign(tpl, 'gl_linux.tpl');
   Reset(tpl);
-  while not EOF(tpl) do begin
+  while not EOF(tpl) do
+  begin
     ReadLn(tpl, s);
-    if Copy(s, 1, 1) = '%' then begin
+    if Copy(s, 1, 1) = '%' then
+    begin
       if s = '%GLDecls' then
         PrintInterface(DefGL.InterfaceBlock, f)
       else if s = '%GLProcs1' then
@@ -126,15 +132,17 @@ begin
 
   // Build GLUT unit
 
-  WriteLn('Generating GLut unit for Linux...');
+  WriteLn('Generating GLUT unit for Linux...');
 
   Assign(f, '../linux/glut.pp');
   Rewrite(f);
   Assign(tpl, 'glut_linux.tpl');
   Reset(tpl);
-  while not EOF(tpl) do begin
+  while not EOF(tpl) do
+  begin
     ReadLn(tpl, s);
-    if Copy(s, 1, 1) = '%' then begin
+    if Copy(s, 1, 1) = '%' then
+    begin
       if s = '%GLUTDecls' then
         PrintInterface(DefGLUT.InterfaceBlock, f)
       else if s = '%GLUTProcs1' then
@@ -143,13 +151,8 @@ begin
         PrintProcLoaders(DefGLUT.Procs, 'libglut')
       else
         WriteLn(f, '// ### c_linuxd: Don''t know what to insert here!: ', s);
-    end else if Copy(s, 1, 1) <> '#' then begin
-      j := Pos('#extdecl', s);
-      if j = 0 then
-        WriteLn(f, s)
-      else
-        WriteLn(f, Copy(s, 1, j - 1), 'cdecl', Copy(s, j + 8, Length(s)));
-    end;
+    end else if Copy(s, 1, 1) <> '#' then
+      WriteLn(f, s);
   end;
   PrintCVSLogSection;
   Close(f);
@@ -160,7 +163,12 @@ end.
 
 {
   $Log$
-  Revision 1.1  1999-12-23 13:51:50  peter
+  Revision 1.2  2000-05-25 18:59:50  sg
+  * Completed GLU and GLUT support
+  * Some minor fixes (missing "const"s, changed some untyped "var" arguments
+    to "const" arguments etc.)
+
+  Revision 1.1  1999/12/23 13:51:50  peter
     * reorganized, it now doesn't depend on fcl anymore by default
 
   Revision 1.2  1999/12/01 00:55:44  alex

+ 164 - 139
packages/opengl/build/gl.def

@@ -1,6 +1,22 @@
 # This is the definition file for all GL functions and types.
 
 %COPY_INTERFACE
+
+// C types
+type
+  SignedChar = ShortInt;
+  UnsignedChar = Byte;
+  Short = SmallInt;
+  SignedShort = Short;
+  UnsignedShort = Word;
+  Int = LongInt;
+  SignedInt = Int;
+  UnsignedInt = LongWord;
+  Float = Single;
+
+  PInt = ^Int;
+
+
 // ===================================================================
 //   GL consts, types and functions
 // ===================================================================
@@ -12,15 +28,24 @@
 
 type
 
-  PSingle = ^Single;
-  PDouble = ^Double;
-
-  GLclampf = Single;    // single precision float in [0,1]
-  GLclampd = Double;    // double precision float in [0,1]
+  PGLvoid = Pointer;
+  GLboolean = Boolean;
+  GLbyte = SignedChar;		// 1-byte signed
+  GLshort = Short;		// 2-byte signed
+  GLint = Int;			// 4-byte signed
+  GLubyte = UnsignedChar;	// 1-byte unsigned
+  GLushort = UnsignedShort;	// 2-byte unsigned
+  GLuint = UnsignedInt;		// 4-byte unsigned
+  GLsizei = Int;		// 4-byte signed
+  GLfloat = Float;		// single precision float
+  GLclampf = Float;		// single precision float in [0,1]
+  GLdouble = Double;		// double precision float
+  GLclampd = Double;		// double precision float in [0,1]
+
+  PGLfloat = ^GLfloat;
 
   GLenum = Integer;
 
-type
   GLbitfield = set of (GL_CURRENT_BIT, GL_POINT_BIT, GL_LINE_BIT,
     GL_POLYGON_BIT, GL_POLYGON_STIPPLE_BIT, GL_PIXEL_MODE_BIT,
     GL_LIGHTING_BIT, GL_FOG_BIT, GL_DEPTH_BUFFER_BIT, GL_ACCUM_BUFFER_BIT,
@@ -40,8 +65,8 @@ const
   GL_NO_ERROR                           = 0;
 
   // Boolean values
-  GL_FALSE                              = 0;
-  GL_TRUE                               = 1;
+  GL_FALSE                              = False;
+  GL_TRUE                               = True;
 
   // Data types
   GL_BYTE                               = $1400;
@@ -670,7 +695,7 @@ var
 
 %PROCS
   // Miscellaneous
-  glClearIndex: procedure(c: Single);
+  glClearIndex: procedure(c: GLfloat);
   glClearColor: procedure(red, green, blue, alpha: GLclampf);
   glClear: procedure(mask: GLbitfield);
   glIndexMask: procedure(mask: LongWord);
@@ -680,18 +705,18 @@ var
   glLogicOp: procedure(opcode: GLenum);
   glCullFace: procedure(mode: GLenum);
   glFrontFace: procedure(mode: GLenum);
-  glPointSize: procedure(size: Single);
-  glLineWidth: procedure(width: Single);
+  glPointSize: procedure(size: GLfloat);
+  glLineWidth: procedure(width: GLfloat);
   glLineStipple: procedure(factor: LongInt; pattern: Word);
   glPolygonMode: procedure(face, mode: GLenum);
-  glPolygonOffset: procedure(factor, units: Single);
+  glPolygonOffset: procedure(factor, units: GLfloat);
   glPolygonStipple: procedure(var mask: Byte);
   glGetPolygonStipple: procedure(var mask: Byte);
   glEdgeFlag: procedure(flag: Boolean);
   glEdgeFlagv: procedure(var flag: Boolean);
   glScissor: procedure(x, y, width, height: LongInt);
-  glClipPlane: procedure(plane: GLenum; var equation: Double);
-  glGetClipPlane: procedure(plane: GLenum; var equation: Double);
+  glClipPlane: procedure(plane: GLenum; var equation: GLdouble);
+  glGetClipPlane: procedure(plane: GLenum; var equation: GLdouble);
   glDrawBuffer: procedure(mode: GLenum);
   glReadBuffer: procedure(mode: GLenum);
   glEnable: procedure(cap: LongInt);
@@ -700,8 +725,8 @@ var
   glEnableClientState: procedure(cap: GLenum);  // 1.1
   glDisableClientState: procedure(cap: GLenum);  // 1.1
   glGetBooleanv: procedure(pname: GLenum; var params: Boolean);
-  glGetDoublev: procedure(pname: GLenum; var params: Double);
-  glGetFloatv: procedure(pname: GLenum; var params: Single);
+  glGetDoublev: procedure(pname: GLenum; var params: GLdouble);
+  glGetFloatv: procedure(pname: GLenum; var params: GLfloat);
   glGetIntegerv: procedure(pname: GLenum; var params: LongInt);
   glPushAttrib: procedure(mask: GLbitfield);
   glPopAttrib: procedure;
@@ -722,27 +747,27 @@ var
   glDepthRange: procedure(near_val, far_val: GLclampd);
 
   // Accumulation Buffer
-  glClearAccum: procedure(red, green, blue, alpha: Single);
-  glAccum: procedure(op: GLenum; value: Single);
+  glClearAccum: procedure(red, green, blue, alpha: GLfloat);
+  glAccum: procedure(op: GLenum; value: GLfloat);
 
   // Tranformation
   glMatrixMode: procedure(mode: GLenum);
-  glOrtho: procedure(left, right, bottom, top, near_val, far_val: Double);
-  glFrustum: procedure(left, right, bottom, top, near_val, far_val: Double);
+  glOrtho: procedure(left, right, bottom, top, near_val, far_val: GLdouble);
+  glFrustum: procedure(left, right, bottom, top, near_val, far_val: GLdouble);
   glViewport: procedure(x, y, width, height: LongInt);
   glPushMatrix: procedure;
   glPopMatrix: procedure;
   glLoadIdentity: procedure;
-  glLoadMatrixd: procedure(var m: Double);
-  glLoadMatrixf: procedure(var m: PSingle);
-  glMultMatrixd: procedure(var m: Double);
-  glMultMatrixf: procedure(var m: Single);
-  glRotated: procedure(angle, x, y, z: Double);
-  glRotatef: procedure(angle, x, y, z: Single);
-  glScaled: procedure(x, y, z: Double);
-  glScalef: procedure(x, y, z: Single);
-  glTranslated: procedure(x, y, z: Double);
-  glTranslatef: procedure(x, y, z: Single);
+  glLoadMatrixd: procedure(var m: GLdouble);
+  glLoadMatrixf: procedure(var m: PGLfloat);
+  glMultMatrixd: procedure(var m: GLdouble);
+  glMultMatrixf: procedure(var m: GLfloat);
+  glRotated: procedure(angle, x, y, z: GLdouble);
+  glRotatef: procedure(angle, x, y, z: GLfloat);
+  glScaled: procedure(x, y, z: GLdouble);
+  glScalef: procedure(x, y, z: GLfloat);
+  glTranslated: procedure(x, y, z: GLdouble);
+  glTranslatef: procedure(x, y, z: GLfloat);
 
   // Display Lists
   glIsList: function(list: LongWord): Boolean;
@@ -757,144 +782,144 @@ var
   // Drawing Functions
   glBegin: procedure(mode: GLenum);
   glEnd: procedure;
-  glVertex2d: procedure(x, y: Double);
-  glVertex2f: procedure(x, y: Single);
+  glVertex2d: procedure(x, y: GLdouble);
+  glVertex2f: procedure(x, y: GLfloat);
   glVertex2i: procedure(x, y: LongInt);
   glVertex2s: procedure(x, y: SmallInt);
-  glVertex3d: procedure(x, y, z: Double);
-  glVertex3f: procedure(x, y, z: Single);
+  glVertex3d: procedure(x, y, z: GLdouble);
+  glVertex3f: procedure(x, y, z: GLfloat);
   glVertex3i: procedure(x, y, z: LongInt);
   glVertex3s: procedure(x, y, z: SmallInt);
-  glVertex4d: procedure(x, y, z, w: Double);
-  glVertex4f: procedure(x, y, z, w: Single);
+  glVertex4d: procedure(x, y, z, w: GLdouble);
+  glVertex4f: procedure(x, y, z, w: GLfloat);
   glVertex4i: procedure(x, y, z, w: LongInt);
   glVertex4s: procedure(x, y, z, w: SmallInt);
-  glVertex2dv: procedure(var v: Double);
-  glVertex2fv: procedure(var v: Single);
+  glVertex2dv: procedure(var v: GLdouble);
+  glVertex2fv: procedure(var v: GLfloat);
   glVertex2iv: procedure(var v: LongInt);
   glVertex2sv: procedure(var v: SmallInt);
-  glVertex3dv: procedure(var v: Double);
-  glVertex3fv: procedure(var v: Single);
+  glVertex3dv: procedure(var v: GLdouble);
+  glVertex3fv: procedure(var v: GLfloat);
   glVertex3iv: procedure(var v: LongInt);
   glVertex3sv: procedure(var v: SmallInt);
-  glVertex4dv: procedure(var v: Double);
-  glVertex4fv: procedure(var v: Single);
+  glVertex4dv: procedure(var v: GLdouble);
+  glVertex4fv: procedure(var v: GLfloat);
   glVertex4iv: procedure(var v: LongInt);
   glVertex4sv: procedure(var v: SmallInt);
   glNormal3b: procedure(nx, ny, nz: Byte);
-  glNormal3d: procedure(nx, ny, nz: Double);
-  glNormal3f: procedure(nx, ny, nz: Single);
+  glNormal3d: procedure(nx, ny, nz: GLdouble);
+  glNormal3f: procedure(nx, ny, nz: GLfloat);
   glNormal3i: procedure(nx, ny, nz: LongInt);
   glNormal3s: procedure(nx, ny, nz: SmallInt);
   glNormal3bv: procedure(var v: ShortInt);
-  glNormal3dv: procedure(var v: Double);
-  glNormal3fv: procedure(var v: Single);
+  glNormal3dv: procedure(var v: GLdouble);
+  glNormal3fv: procedure(var v: GLfloat);
   glNormal3iv: procedure(var v: LongInt);
   glNormal3sv: procedure(var v: SmallInt);
-  glIndexd: procedure(c: Double);
-  glIndexf: procedure(c: Single);
+  glIndexd: procedure(c: GLdouble);
+  glIndexf: procedure(c: GLfloat);
   glIndexi: procedure(c: LongInt);
   glIndexs: procedure(c: SmallInt);
   glIndexub: procedure(c: Byte);  // 1.1
-  glIndexdv: procedure(var c: Double);
-  glIndexfv: procedure(var c: Single);
+  glIndexdv: procedure(var c: GLdouble);
+  glIndexfv: procedure(var c: GLfloat);
   glIndexiv: procedure(var c: LongInt);
   glIndexsv: procedure(var c: SmallInt);
   glIndexubv: procedure(var c: Byte);  // 1.1
   glColor3b : procedure(red, green, blue: ShortInt);
-  glColor3d : procedure(red, green, blue: Double);
-  glColor3f : procedure(red, green, blue: Single);
+  glColor3d : procedure(red, green, blue: GLdouble);
+  glColor3f : procedure(red, green, blue: GLfloat);
   glColor3i : procedure(red, green, blue: LongInt);
   glColor3s : procedure(red, green, blue: SmallInt);
   glColor3ub: procedure(red, green, blue: Byte);
   glColor3ui: procedure(red, green, blue: LongWord);
   glColor3us: procedure(red, green, blue: Word);
   glColor4b : procedure(red, green, blue, alpha: ShortInt);
-  glColor4d : procedure(red, green, blue, alpha: Double);
-  glColor4f : procedure(red, green, blue, alpha: Single);
+  glColor4d : procedure(red, green, blue, alpha: GLdouble);
+  glColor4f : procedure(red, green, blue, alpha: GLfloat);
   glColor4i : procedure(red, green, blue, alpha: LongInt);
   glColor4s : procedure(red, green, blue, alpha: SmallInt);
   glColor4ub: procedure(red, green, blue, alpha: Byte);
   glColor4ui: procedure(red, green, blue, alpha: LongWord);
   glColor4us: procedure(red, green, blue, alpha: Word);
   glColor3bv : procedure(var v: ShortInt);
-  glColor3dv : procedure(var v: Double);
-  glColor3fv : procedure(var v: Single);
+  glColor3dv : procedure(var v: GLdouble);
+  glColor3fv : procedure(var v: GLfloat);
   glColor3iv : procedure(var v: LongInt);
   glColor3sv : procedure(var v: SmallInt);
   glColor3ubv: procedure(var v: Byte);
   glColor3uiv: procedure(var v: LongWord);
   glColor3usv: procedure(var v: Word);
   glColor4bv : procedure(var v: ShortInt);
-  glColor4dv : procedure(var v: Double);
-  glColor4fv : procedure(var v: Single);
+  glColor4dv : procedure(var v: GLdouble);
+  glColor4fv : procedure(var v: GLfloat);
   glColor4iv : procedure(var v: LongInt);
   glColor4sv : procedure(var v: SmallInt);
   glColor4ubv: procedure(var v: Byte);
   glColor4uiv: procedure(var v: LongWord);
   glColor4usv: procedure(var v: Word);
-  glTexCoord1d: procedure(s: Double);
-  glTexCoord1f: procedure(s: Single);
+  glTexCoord1d: procedure(s: GLdouble);
+  glTexCoord1f: procedure(s: GLfloat);
   glTexCoord1i: procedure(s: LongInt);
   glTexCoord1s: procedure(s: SmallInt);
-  glTexCoord2d: procedure(s, t: Double);
-  glTexCoord2f: procedure(s, t: Single);
+  glTexCoord2d: procedure(s, t: GLdouble);
+  glTexCoord2f: procedure(s, t: GLfloat);
   glTexCoord2i: procedure(s, t: LongInt);
   glTexCoord2s: procedure(s, t: SmallInt);
-  glTexCoord3d: procedure(s, t, r: Double);
-  glTexCoord3f: procedure(s, t, r: Single);
+  glTexCoord3d: procedure(s, t, r: GLdouble);
+  glTexCoord3f: procedure(s, t, r: GLfloat);
   glTexCoord3i: procedure(s, t, r: LongInt);
   glTexCoord3s: procedure(s, t, r: SmallInt);
-  glTexCoord4d: procedure(s, t, r, q: Double);
-  glTexCoord4f: procedure(s, t, r, q: Single);
+  glTexCoord4d: procedure(s, t, r, q: GLdouble);
+  glTexCoord4f: procedure(s, t, r, q: GLfloat);
   glTexCoord4i: procedure(s, t, r, q: LongInt);
   glTexCoord4s: procedure(s, t, r, q: SmallInt);
-  glTexCoord1dv: procedure(var v: Double);
-  glTexCoord1fv: procedure(var v: Single);
+  glTexCoord1dv: procedure(var v: GLdouble);
+  glTexCoord1fv: procedure(var v: GLfloat);
   glTexCoord1iv: procedure(var v: LongInt);
   glTexCoord1sv: procedure(var v: SmallInt);
-  glTexCoord2dv: procedure(var v: Double);
-  glTexCoord2fv: procedure(var v: Single);
+  glTexCoord2dv: procedure(var v: GLdouble);
+  glTexCoord2fv: procedure(var v: GLfloat);
   glTexCoord2iv: procedure(var v: LongInt);
   glTexCoord2sv: procedure(var v: SmallInt);
-  glTexCoord3dv: procedure(var v: Double);
-  glTexCoord3fv: procedure(var v: Single);
+  glTexCoord3dv: procedure(var v: GLdouble);
+  glTexCoord3fv: procedure(var v: GLfloat);
   glTexCoord3iv: procedure(var v: LongInt);
   glTexCoord3sv: procedure(var v: SmallInt);
-  glTexCoord4dv: procedure(var v: Double);
-  glTexCoord4fv: procedure(var v: Single);
+  glTexCoord4dv: procedure(var v: GLdouble);
+  glTexCoord4fv: procedure(var v: GLfloat);
   glTexCoord4iv: procedure(var v: LongInt);
   glTexCoord4sv: procedure(var v: SmallInt);
-  glRasterPos2d: procedure(x, y: Double);
-  glRasterPos2f: procedure(x, y: Single);
+  glRasterPos2d: procedure(x, y: GLdouble);
+  glRasterPos2f: procedure(x, y: GLfloat);
   glRasterPos2i: procedure(x, y: LongInt);
   glRasterPos2s: procedure(x, y: SmallInt);
-  glRasterPos3d: procedure(x, y, z: Double);
-  glRasterPos3f: procedure(x, y, z: Single);
+  glRasterPos3d: procedure(x, y, z: GLdouble);
+  glRasterPos3f: procedure(x, y, z: GLfloat);
   glRasterPos3i: procedure(x, y, z: LongInt);
   glRasterPos3s: procedure(x, y, z: SmallInt);
-  glRasterPos4d: procedure(x, y, z, w: Double);
-  glRasterPos4f: procedure(x, y, z, w: Single);
+  glRasterPos4d: procedure(x, y, z, w: GLdouble);
+  glRasterPos4f: procedure(x, y, z, w: GLfloat);
   glRasterPos4i: procedure(x, y, z, w: LongInt);
   glRasterPos4s: procedure(x, y, z, w: SmallInt);
-  glRasterPos2dv: procedure(var v: Double);
-  glRasterPos2fv: procedure(var v: Single);
+  glRasterPos2dv: procedure(var v: GLdouble);
+  glRasterPos2fv: procedure(var v: GLfloat);
   glRasterPos2iv: procedure(var v: LongInt);
   glRasterPos2sv: procedure(var v: SmallInt);
-  glRasterPos3dv: procedure(var v: Double);
-  glRasterPos3fv: procedure(var v: Single);
+  glRasterPos3dv: procedure(var v: GLdouble);
+  glRasterPos3fv: procedure(var v: GLfloat);
   glRasterPos3iv: procedure(var v: LongInt);
   glRasterPos3sv: procedure(var v: SmallInt);
-  glRasterPos4dv: procedure(var v: Double);
-  glRasterPos4fv: procedure(var v: Single);
+  glRasterPos4dv: procedure(var v: GLdouble);
+  glRasterPos4fv: procedure(var v: GLfloat);
   glRasterPos4iv: procedure(var v: LongInt);
   glRasterPos4sv: procedure(var v: SmallInt);
-  glRectd: procedure(x1, y1, x2, y2: Double);
-  glRectf: procedure(x1, y1, x2, y2: Single);
+  glRectd: procedure(x1, y1, x2, y2: GLdouble);
+  glRectf: procedure(x1, y1, x2, y2: GLfloat);
   glRecti: procedure(x1, y1, x2, y2: LongInt);
   glRects: procedure(x1, y1, x2, y2: SmallInt);
-  glRectdv: procedure(var v1, v2: Double);
-  glRectfv: procedure(var v1, v2: Single);
+  glRectdv: procedure(var v1, v2: GLdouble);
+  glRectfv: procedure(var v1, v2: GLfloat);
   glRectiv: procedure(var v1, v2: LongInt);
   glRectsv: procedure(var v1, v2: SmallInt);
 
@@ -913,37 +938,37 @@ var
 
   // Lighting
   glShadeModel: procedure(mode: GLenum);
-  glLightf: procedure(light, pname: GLenum; param: Single);
+  glLightf: procedure(light, pname: GLenum; param: GLfloat);
   glLighti: procedure(light, pname: GLenum; param: LongInt);
-  glLightfv: procedure(light, pname: GLenum; var params: Single);
+  glLightfv: procedure(light, pname: GLenum; var params: GLfloat);
   glLightiv: procedure(light, pname: GLenum; var params: LongInt);
-  glGetLightfv: procedure(light, pname: GLenum; var params: Single);
+  glGetLightfv: procedure(light, pname: GLenum; var params: GLfloat);
   glGetLightiv: procedure(light, pname: GLenum; var params: LongInt);
-  glLightModelf: procedure(pname: GLenum; param: Single);
+  glLightModelf: procedure(pname: GLenum; param: GLfloat);
   glLightModeli: procedure(pname: GLenum; param: LongInt);
-  glLightModelfv: procedure(pname: GLenum; var params: Single);
+  glLightModelfv: procedure(pname: GLenum; var params: GLfloat);
   glLightModeliv: procedure(pname: GLenum; var param: LongInt);
-  glMaterialf: procedure(face, pname: GLenum; param: Single);
+  glMaterialf: procedure(face, pname: GLenum; param: GLfloat);
   glMateriali: procedure(face, pname: GLenum; param: LongInt);
-  glMaterialfv: procedure(face, pname: GLenum; var params: Single);
+  glMaterialfv: procedure(face, pname: GLenum; var params: GLfloat);
   glMaterialiv: procedure(face, pname: GLenum; var params: LongInt);
-  glGetMaterialfv: procedure(face, pname: GLenum; var params: Single);
+  glGetMaterialfv: procedure(face, pname: GLenum; var params: GLfloat);
   glGetMaterialiv: procedure(face, pname: GLenum; var params: LongInt);
   glColorMaterial: procedure(face, mode: GLenum);
 
   // Raster Functions
-  glPixelZoom: procedure(xfactor, yfactor: Single);
-  glPixelStoref: procedure(pname: GLenum; param: Single);
+  glPixelZoom: procedure(xfactor, yfactor: GLfloat);
+  glPixelStoref: procedure(pname: GLenum; param: GLfloat);
   glPixelStorei: procedure(pname: GLenum; param: LongInt);
-  glPixelTransferf: procedure(pname: GLenum; param: Single);
+  glPixelTransferf: procedure(pname: GLenum; param: GLfloat);
   glPixelTransferi: procedure(pname: GLenum; param: LongInt);
-  glPixelMapfv: procedure(map: GLenum; mapsize: LongInt; var values: Single);
+  glPixelMapfv: procedure(map: GLenum; mapsize: LongInt; var values: GLfloat);
   glPixelMapuiv: procedure(map: GLenum; mapsize: LongInt; var values: LongWord);
   glPixelMapusv: procedure(map: GLenum; mapsize: LongInt; var values: Word);
-  glGetPixelMapfv: procedure(map: GLenum; var values: Single);
+  glGetPixelMapfv: procedure(map: GLenum; var values: GLfloat);
   glGetPixelMapuiv: procedure(map: GLenum; var values: LongWord);
   glGetPixelMapusv: procedure(map: GLenum; var values: Word);
-  glBitmap: procedure(width, height: LongInt; xorig, yorig, xmove, ymove: Single; var bitmap);
+  glBitmap: procedure(width, height: LongInt; xorig, yorig, xmove, ymove: GLfloat; var bitmap);
   glReadPixels: procedure(x, y, width, height: LongInt; format, AType: GLenum; var pixels);
   glDrawPixels: procedure(width, height: LongInt; format, AType: GLenum; var pixels);
   glCopyPixels: procedure(x, y, width, height: LongInt; AType: GLenum);
@@ -955,28 +980,28 @@ var
   glClearStencil: procedure(s: LongInt);
 
   // Texture Mapping
-  glTexGend: procedure(cord, pname: GLenum; param: Double);
-  glTexGenf: procedure(cord, pname: GLenum; param: Single);
+  glTexGend: procedure(cord, pname: GLenum; param: GLdouble);
+  glTexGenf: procedure(cord, pname: GLenum; param: GLfloat);
   glTexGeni: procedure(cord, pname: GLenum; param: LongInt);
-  glTexGendv: procedure(cord, pname: GLenum; var params: Double);
-  glTexGenfv: procedure(cord, pname: GLenum; var params: Single);
+  glTexGendv: procedure(cord, pname: GLenum; var params: GLdouble);
+  glTexGenfv: procedure(cord, pname: GLenum; var params: GLfloat);
   glTexGeniv: procedure(cord, pname: GLenum; var params: LongInt);
-  glGetTexGendv: procedure(cord, pname: GLenum; var params: Double);
-  glGetTexGenfv: procedure(cord, pname: GLenum; var params: Single);
+  glGetTexGendv: procedure(cord, pname: GLenum; var params: GLdouble);
+  glGetTexGenfv: procedure(cord, pname: GLenum; var params: GLfloat);
   glGetTexGeniv: procedure(cord, pname: GLenum; var params: LongInt);
-  glTexEnvf: procedure(target, pname: GLenum; param: Single);
+  glTexEnvf: procedure(target, pname: GLenum; param: GLfloat);
   glTexEnvi: procedure(target, pname: GLenum; param: LongInt);
-  glTexEnvfv: procedure(target, pname: GLenum; var params: Single);
+  glTexEnvfv: procedure(target, pname: GLenum; var params: GLfloat);
   glTexEnviv: procedure(target, pname: GLenum; var params: LongInt);
-  glGetTexEnvfv: procedure(target, pname: GLenum; var params: Single);
+  glGetTexEnvfv: procedure(target, pname: GLenum; var params: GLfloat);
   glGetTexEnviv: procedure(target, pname: GLenum; var params: LongInt);
-  glTexParameterf: procedure(target, pname: GLenum; param: Single);
+  glTexParameterf: procedure(target, pname: GLenum; param: GLfloat);
   glTexParameteri: procedure(target, pname: GLenum; param: LongInt);
-  glTexParameterfv: procedure(target, pname: GLenum; var params: Single);
+  glTexParameterfv: procedure(target, pname: GLenum; var params: GLfloat);
   glTexParameteriv: procedure(target, pname: GLenum; var params: LongInt);
-  glGetTexParameterfv: procedure(target, pname: GLenum; var params: Single);
+  glGetTexParameterfv: procedure(target, pname: GLenum; var params: GLfloat);
   glGetTexParameteriv: procedure(target, pname: GLenum; var params: LongInt);
-  glGetTexLevelParameterfv: procedure(target: GLenum; level: LongInt; pname: GLenum; var params: Single);
+  glGetTexLevelParameterfv: procedure(target: GLenum; level: LongInt; pname: GLenum; var params: GLfloat);
   glGetTexLevelParameteriv: procedure(target: GLenum; level: LongInt; pname: GLenum; var params: LongInt);
   glTexImage1D: procedure(target: GLenum; level, internalFormat, width, border: LongInt; format, AType: GLenum; var pixels);
   glTexImage2D: procedure(target: GLenum; level, internalFormat, width, height, border: LongInt; format, AType: GLenum; var pixels);
@@ -996,39 +1021,39 @@ var
   glCopyTexSubImage2D: procedure(target: GLenum; level, xoffset, yoffset, x, y, width, height: LongInt);
 
   // Evaluators
-  glMap1d: procedure(target: GLenum; u1, u2: Double; stride, order: LongInt; var points: Double);
-  glMap1f: procedure(target: GLenum; u1, u2: Single; stride, order: LongInt; var points: Single);
-  glMap2d: procedure(target: GLenum; u1, u2: Double; ustride, uorder: LongInt; v1, v2: Double; vstride, vorder: LongInt; var points: Double);
-  glMap2f: procedure(target: GLenum; u1, u2: Single; ustride, uorder: LongInt; v1, v2: Single; vstride, vorder: LongInt; var points: Single);
-  glGetMapdv: procedure(target, query: GLenum; var v: Double);
-  glGetMapfv: procedure(target, query: GLenum; var v: Single);
+  glMap1d: procedure(target: GLenum; u1, u2: GLdouble; stride, order: LongInt; var points: GLdouble);
+  glMap1f: procedure(target: GLenum; u1, u2: GLfloat; stride, order: LongInt; var points: GLfloat);
+  glMap2d: procedure(target: GLenum; u1, u2: GLdouble; ustride, uorder: LongInt; v1, v2: GLdouble; vstride, vorder: LongInt; var points: GLdouble);
+  glMap2f: procedure(target: GLenum; u1, u2: GLfloat; ustride, uorder: LongInt; v1, v2: GLfloat; vstride, vorder: LongInt; var points: GLfloat);
+  glGetMapdv: procedure(target, query: GLenum; var v: GLdouble);
+  glGetMapfv: procedure(target, query: GLenum; var v: GLfloat);
   glGetMapiv: procedure(target, query: GLenum; var v: LongInt);
-  glEvalCoord1d: procedure(u: Double);
-  glEvalCoord1f: procedure(u: Single);
-  glEvalCoord1dv: procedure(var u: Double);
-  glEvalCoord1fv: procedure(var u: Single);
-  glEvalCoord2d: procedure(u, v: Double);
-  glEvalCoord2f: procedure(u, v: Single);
-  glEvalCoord2dv: procedure(var u, v: Double);
-  glEvalCoord2fv: procedure(var u, v: Single);
-  glMapGrid1d: procedure(un: LongInt; u1, u2: Double);
-  glMapGrid1f: procedure(un: LongInt; u1, u2: Single);
-  glMapGrid2d: procedure(un: LongInt; u1, u2: Double; vn: LongInt; v1, v2: Double);
-  glMapGrid2f: procedure(un: LongInt; u1, u2: Single; vn: LongInt; v1, v2: Single);
+  glEvalCoord1d: procedure(u: GLdouble);
+  glEvalCoord1f: procedure(u: GLfloat);
+  glEvalCoord1dv: procedure(var u: GLdouble);
+  glEvalCoord1fv: procedure(var u: GLfloat);
+  glEvalCoord2d: procedure(u, v: GLdouble);
+  glEvalCoord2f: procedure(u, v: GLfloat);
+  glEvalCoord2dv: procedure(var u, v: GLdouble);
+  glEvalCoord2fv: procedure(var u, v: GLfloat);
+  glMapGrid1d: procedure(un: LongInt; u1, u2: GLdouble);
+  glMapGrid1f: procedure(un: LongInt; u1, u2: GLfloat);
+  glMapGrid2d: procedure(un: LongInt; u1, u2: GLdouble; vn: LongInt; v1, v2: GLdouble);
+  glMapGrid2f: procedure(un: LongInt; u1, u2: GLfloat; vn: LongInt; v1, v2: GLfloat);
   glEvalPoint1: procedure(i: LongInt);
   glEvalPoint2: procedure(i, j: LongInt);
   glEvalMesh1: procedure(mode: GLenum; i1, i2: LongInt);
   glEvalMesh2: procedure(mode: GLenum; i1, i2, j1, j2: LongInt);
 
   // Fog
-  glFogf: procedure(pname: GLenum; param: Single);
+  glFogf: procedure(pname: GLenum; param: GLfloat);
   glFogi: procedure(pname: GLenum; param: LongInt);
-  glFogfv: procedure(pname: GLenum; var params: Single);
+  glFogfv: procedure(pname: GLenum; var params: GLfloat);
   glFogiv: procedure(pname: GLenum; var params: LongInt);
 
   // Selection and Feedback
-  glFeedbackBuffer: procedure(size: LongInt; AType: GLenum; var buffer: Single);
-  glPassThrough: procedure(token: Single);
+  glFeedbackBuffer: procedure(size: LongInt; AType: GLenum; var buffer: GLfloat);
+  glPassThrough: procedure(token: GLfloat);
   glSelectBuffer: procedure(size: LongInt; var buffer: LongWord);
   glInitNames: procedure;
   glLoadName: procedure(name: LongWord);

+ 45 - 33
packages/opengl/build/gl_linux.tpl

@@ -1,41 +1,47 @@
 {
   $Id$
-  Translation of the Mesa GL, GLU and GLX headers for Free Pascal
-  Linux Version, Copyright (C) 1999-2000 Sebastian Guenther
+  Translation of the Mesa GL, GLU and GLX headers for Free Pascal, Linux version
+  Copyright (C) 1999-2000 Sebastian Guenther, [email protected]
 
 
   Mesa 3-D graphics library
-  Version:  3.0
-  Copyright (C) 1995-1998  Brian Paul
-
-  This library is free software; you can redistribute it and/or
-  modify it under the terms of the GNU Library General Public
-  License as published by the Free Software Foundation; either
-  version 2 of the License, or (at your option) any later version.
-
-  This library is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-  Library General Public License for more details.
-
-  You should have received a copy of the GNU Library General Public
-  License along with this library; if not, write to the Free
-  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+  Version:  3.1
+
+  Copyright (C) 1999  Brian Paul   All Rights Reserved.
+
+  Permission is hereby granted, free of charge, to any person obtaining a
+  copy of this software and associated documentation files (the "Software"),
+  to deal in the Software without restriction, including without limitation
+  the rights to use, copy, modify, merge, publish, distribute, sublicense,
+  and/or sell copies of the Software, and to permit persons to whom the
+  Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included
+  in all copies or substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+  BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+  AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 }
 
-{$MODE delphi}  // objfpc would not work because of direct proc var assignments
 
 unit GL;
 
+{$MODE delphi}  // objfpc would not work because of direct proc var assignments
+
 interface
-uses X,XLib,XUtil;
+
+uses X, XLib, XUtil;
 
 // ===================================================================
 //   Unit specific extensions
 // ===================================================================
 
-function InitGLFromLibrary(libname: PChar): Boolean;
-function InitGLUFromLibrary(libname: PChar): Boolean;
+function InitGLFromLibrary(const libname: PChar): Boolean;
+function InitGLUFromLibrary(const libname: PChar): Boolean;
 // Requires that the GL library has already been initialized:
 function InitGLX: Boolean;
 
@@ -81,12 +87,12 @@ function dlopen(AFile: PChar; mode: LongInt): Pointer; external 'dl';
 function dlclose(handle: Pointer): LongInt; external 'dl';
 function dlsym(handle: Pointer; name: PChar): Pointer; external 'dl';
 
-function LoadLibrary(name: PChar): Pointer;
+function LoadLibrary(const name: PChar): Pointer;
 begin
   Result := dlopen(name, $101 {RTLD_GLOBAL or RTLD_LAZY});
 end;
 
-function GetProc(handle: Pointer; name: PChar): Pointer;
+function GetProc(handle: Pointer; const name: PChar): Pointer;
 begin
   Result := dlsym(handle, name);
   if not Assigned(Result) and GLDumpUnresolvedFunctions then
@@ -96,11 +102,12 @@ end;
 var
   libGL, libGLU, libGLX: Pointer;
 
-function InitGLFromLibrary(libname: PChar): Boolean;
+function InitGLFromLibrary(const libname: PChar): Boolean;
 begin
   Result := False;
   libGL := LoadLibrary(libname);
-  if not Assigned(libGL) then exit;
+  if not Assigned(libGL) then
+    exit;
 
 %GLProcs2
 #  // Extensions:
@@ -110,11 +117,12 @@ begin
   Result := True;
 end;
 
-function InitGLUFromLibrary(libname: PChar): Boolean;
+function InitGLUFromLibrary(const libname: PChar): Boolean;
 begin
   Result := False;
   libGLU := LoadLibrary(libname);
-  if not Assigned(libGLU) then exit;
+  if not Assigned(libGLU) then
+    exit;
 
 %GLUProcs2
 
@@ -125,7 +133,8 @@ end;
 function InitGLX: Boolean;
 begin
   Result := False;
-  if not Assigned(libGL) then exit;
+  if not Assigned(libGL) then
+    exit;
 
 %GLXProcs2
 
@@ -146,9 +155,12 @@ begin
 end;
 
 
-
 finalization
-  if Assigned(libGL)  then dlclose(libGL);
-  if Assigned(libGLU) then dlclose(libGLU);
-  if Assigned(libGLX) then dlclose(libGLX);
+  // Free all loaded libraries
+  if Assigned(libGLX) then
+    dlclose(libGLX);
+  if Assigned(libGLU) then
+    dlclose(libGLU);
+  if Assigned(libGL) then
+    dlclose(libGL);
 end.

+ 48 - 48
packages/opengl/build/glext.def

@@ -156,7 +156,7 @@ var
   glBlendColorEXT: procedure(red, green, blue, alpha: GLclampf);
 
   // GL_EXT_polygon_offset
-  glPolygonOffsetEXT: procedure(factor, bias: Single);
+  glPolygonOffsetEXT: procedure(factor, bias: GLfloat);
 
   // GL_EXT_vertex_array
   glVertexPointerEXT: procedure(size: LongInt; AType: GLenum; stride, count: LongInt; var ptr);
@@ -186,38 +186,38 @@ var
   glColorTableEXT: procedure(target, internalformat: GLenum; width: LongInt; format, AType: GLenum; var table);
   glColorSubTableEXT: procedure(target: GLenum; start, count: LongInt; format, AType: GLEnum; var data);
   glGetColorTableEXT: procedure(target, format, AType: GLenum; var table);
-  glGetColorTableParameterfvEXT: procedure(target, pname: GLenum; var params: Single);
+  glGetColorTableParameterfvEXT: procedure(target, pname: GLenum; var params: GLfloat);
   glGetColorTableParameterivEXT: procedure(target, pname: GLenum; var params: LongInt);
 
   // GL_SGIS_multitexture
-  glMultiTexCoord1dSGIS: procedure(target: GLenum; s: Double);
-  glMultiTexCoord1dvSGIS: procedure(target: GLenum; var v: Double);
-  glMultiTexCoord1fSGIS: procedure(target: GLenum; s: Single);
-  glMultiTexCoord1fvSGIS: procedure(target: GLenum; var v: Single);
+  glMultiTexCoord1dSGIS: procedure(target: GLenum; s: GLdouble);
+  glMultiTexCoord1dvSGIS: procedure(target: GLenum; var v: GLdouble);
+  glMultiTexCoord1fSGIS: procedure(target: GLenum; s: GLfloat);
+  glMultiTexCoord1fvSGIS: procedure(target: GLenum; var v: GLfloat);
   glMultiTexCoord1iSGIS: procedure(target: GLenum; s: LongInt);
   glMultiTexCoord1ivSGIS: procedure(target: GLenum; var v: LongInt);
   glMultiTexCoord1sSGIS: procedure(target: GLenum; s: ShortInt);
   glMultiTexCoord1svSGIS: procedure(target: GLenum; var v: ShortInt);
-  glMultiTexCoord2dSGIS: procedure(target: GLenum; s, t: Double);
-  glMultiTexCoord2dvSGIS: procedure(target: GLenum; var v: Double);
-  glMultiTexCoord2fSGIS: procedure(target: GLenum; s, t: Single);
-  glMultiTexCoord2fvSGIS: procedure(target: GLenum; var v: Single);
+  glMultiTexCoord2dSGIS: procedure(target: GLenum; s, t: GLdouble);
+  glMultiTexCoord2dvSGIS: procedure(target: GLenum; var v: GLdouble);
+  glMultiTexCoord2fSGIS: procedure(target: GLenum; s, t: GLfloat);
+  glMultiTexCoord2fvSGIS: procedure(target: GLenum; var v: GLfloat);
   glMultiTexCoord2iSGIS: procedure(target: GLenum; s, t: LongInt);
   glMultiTexCoord2ivSGIS: procedure(target: GLenum; var v: LongInt);
   glMultiTexCoord2sSGIS: procedure(target: GLenum; s, t: ShortInt);
   glMultiTexCoord2svSGIS: procedure(target: GLenum; var v: ShortInt);
-  glMultiTexCoord3dSGIS: procedure(target: GLenum; s, t, r: Double);
-  glMultiTexCoord3dvSGIS: procedure(target: GLenum; var v: Double);
-  glMultiTexCoord3fSGIS: procedure(target: GLenum; s, t, r: Single);
-  glMultiTexCoord3fvSGIS: procedure(target: GLenum; var v: Single);
+  glMultiTexCoord3dSGIS: procedure(target: GLenum; s, t, r: GLdouble);
+  glMultiTexCoord3dvSGIS: procedure(target: GLenum; var v: GLdouble);
+  glMultiTexCoord3fSGIS: procedure(target: GLenum; s, t, r: GLfloat);
+  glMultiTexCoord3fvSGIS: procedure(target: GLenum; var v: GLfloat);
   glMultiTexCoord3iSGIS: procedure(target: GLenum; s, t, r: LongInt);
   glMultiTexCoord3ivSGIS: procedure(target: GLenum; var v: LongInt);
   glMultiTexCoord3sSGIS: procedure(target: GLenum; s, t, r: ShortInt);
   glMultiTexCoord3svSGIS: procedure(target: GLenum; var v: ShortInt);
-  glMultiTexCoord4dSGIS: procedure(target: GLenum; s, t, r, q: Double);
-  glMultiTexCoord4dvSGIS: procedure(target: GLenum; var v: Double);
-  glMultiTexCoord4fSGIS: procedure(target: GLenum; s, t, r, q: Single);
-  glMultiTexCoord4fvSGIS: procedure(target: GLenum; var v: Single);
+  glMultiTexCoord4dSGIS: procedure(target: GLenum; s, t, r, q: GLdouble);
+  glMultiTexCoord4dvSGIS: procedure(target: GLenum; var v: GLdouble);
+  glMultiTexCoord4fSGIS: procedure(target: GLenum; s, t, r, q: GLfloat);
+  glMultiTexCoord4fvSGIS: procedure(target: GLenum; var v: GLfloat);
   glMultiTexCoord4iSGIS: procedure(target: GLenum; s, t, r, q: LongInt);
   glMultiTexCoord4ivSGIS: procedure(target: GLenum; var v: LongInt);
   glMultiTexCoord4sSGIS: procedure(target: GLenum; s, t, r, q: ShortInt);
@@ -227,34 +227,34 @@ var
   glSelectTextureCoordSetSGIS: procedure(target: GLenum);
 
   // GL_EXT_multitexture
-  glMultiTexCoord1dEXT: procedure(target: GLenum; s: Double);
-  glMultiTexCoord1dvEXT: procedure(target: GLenum; var v: Double);
-  glMultiTexCoord1fEXT: procedure(target: GLenum; s: Single);
-  glMultiTexCoord1fvEXT: procedure(target: GLenum; var v: Single);
+  glMultiTexCoord1dEXT: procedure(target: GLenum; s: GLdouble);
+  glMultiTexCoord1dvEXT: procedure(target: GLenum; var v: GLdouble);
+  glMultiTexCoord1fEXT: procedure(target: GLenum; s: GLfloat);
+  glMultiTexCoord1fvEXT: procedure(target: GLenum; var v: GLfloat);
   glMultiTexCoord1iEXT: procedure(target: GLenum; s: LongInt);
   glMultiTexCoord1ivEXT: procedure(target: GLenum; var v: LongInt);
   glMultiTexCoord1sEXT: procedure(target: GLenum; s: ShortInt);
   glMultiTexCoord1svEXT: procedure(target: GLenum; var v: ShortInt);
-  glMultiTexCoord2dEXT: procedure(target: GLenum; s, t: Double);
-  glMultiTexCoord2dvEXT: procedure(target: GLenum; var v: Double);
-  glMultiTexCoord2fEXT: procedure(target: GLenum; s, t: Single);
-  glMultiTexCoord2fvEXT: procedure(target: GLenum; var v: Single);
+  glMultiTexCoord2dEXT: procedure(target: GLenum; s, t: GLdouble);
+  glMultiTexCoord2dvEXT: procedure(target: GLenum; var v: GLdouble);
+  glMultiTexCoord2fEXT: procedure(target: GLenum; s, t: GLfloat);
+  glMultiTexCoord2fvEXT: procedure(target: GLenum; var v: GLfloat);
   glMultiTexCoord2iEXT: procedure(target: GLenum; s, t: LongInt);
   glMultiTexCoord2ivEXT: procedure(target: GLenum; var v: LongInt);
   glMultiTexCoord2sEXT: procedure(target: GLenum; s, t: ShortInt);
   glMultiTexCoord2svEXT: procedure(target: GLenum; var v: ShortInt);
-  glMultiTexCoord3dEXT: procedure(target: GLenum; s, t, r: Double);
-  glMultiTexCoord3dvEXT: procedure(target: GLenum; var v: Double);
-  glMultiTexCoord3fEXT: procedure(target: GLenum; s, t, r: Single);
-  glMultiTexCoord3fvEXT: procedure(target: GLenum; var v: Single);
+  glMultiTexCoord3dEXT: procedure(target: GLenum; s, t, r: GLdouble);
+  glMultiTexCoord3dvEXT: procedure(target: GLenum; var v: GLdouble);
+  glMultiTexCoord3fEXT: procedure(target: GLenum; s, t, r: GLfloat);
+  glMultiTexCoord3fvEXT: procedure(target: GLenum; var v: GLfloat);
   glMultiTexCoord3iEXT: procedure(target: GLenum; s, t, r: LongInt);
   glMultiTexCoord3ivEXT: procedure(target: GLenum; var v: LongInt);
   glMultiTexCoord3sEXT: procedure(target: GLenum; s, t, r: ShortInt);
   glMultiTexCoord3svEXT: procedure(target: GLenum; var v: ShortInt);
-  glMultiTexCoord4dEXT: procedure(target: GLenum; s, t, r, q: Double);
-  glMultiTexCoord4dvEXT: procedure(target: GLenum; var v: Double);
-  glMultiTexCoord4fEXT: procedure(target: GLenum; s, t, r, q: Single);
-  glMultiTexCoord4fvEXT: procedure(target: GLenum; var v: Single);
+  glMultiTexCoord4dEXT: procedure(target: GLenum; s, t, r, q: GLdouble);
+  glMultiTexCoord4dvEXT: procedure(target: GLenum; var v: GLdouble);
+  glMultiTexCoord4fEXT: procedure(target: GLenum; s, t, r, q: GLfloat);
+  glMultiTexCoord4fvEXT: procedure(target: GLenum; var v: GLfloat);
   glMultiTexCoord4iEXT: procedure(target: GLenum; s, t, r, q: LongInt);
   glMultiTexCoord4ivEXT: procedure(target: GLenum; var v: LongInt);
   glMultiTexCoord4sEXT: procedure(target: GLenum; s, t, r, q: ShortInt);
@@ -265,34 +265,34 @@ var
   glSelectTextureTransformEXT: procedure(target: GLenum);
 
   // GL_EXT_point_parameters
-  glPointParameterfEXT: procedure(pname: GLenum; param: Single);
-  glPointParameterfvEXT: procedure(pname: GLenum; var params: Single);
+  glPointParameterfEXT: procedure(pname: GLenum; param: GLfloat);
+  glPointParameterfvEXT: procedure(pname: GLenum; var params: GLfloat);
 
   // GL_MESA_window_pos
   glWindowPos2iMESA: procedure(x, y: LongInt);
   glWindowPos2sMESA: procedure(x, y: ShortInt);
-  glWindowPos2fMESA: procedure(x, y: Single);
-  glWindowPos2dMESA: procedure(x, y: Double);
+  glWindowPos2fMESA: procedure(x, y: GLfloat);
+  glWindowPos2dMESA: procedure(x, y: GLdouble);
   glWindowPos2ivMESA: procedure(var p: LongInt);
   glWindowPos2svMESA: procedure(var p: ShortInt);
-  glWindowPos2fvMESA: procedure(var p: Single);
-  glWindowPos2dvMESA: procedure(var p: Double);
+  glWindowPos2fvMESA: procedure(var p: GLfloat);
+  glWindowPos2dvMESA: procedure(var p: GLdouble);
   glWindowPos3iMESA: procedure(x, y, z: LongInt);
   glWindowPos3sMESA: procedure(x, y, z: ShortInt);
-  glWindowPos3fMESA: procedure(x, y, z: Single);
-  glWindowPos3dMESA: procedure(x, y, z: Double);
+  glWindowPos3fMESA: procedure(x, y, z: GLfloat);
+  glWindowPos3dMESA: procedure(x, y, z: GLdouble);
   glWindowPos3ivMESA: procedure(var p: LongInt);
   glWindowPos3svMESA: procedure(var p: ShortInt);
-  glWindowPos3fvMESA: procedure(var p: Single);
-  glWindowPos3dvMESA: procedure(var p: Double);
+  glWindowPos3fvMESA: procedure(var p: GLfloat);
+  glWindowPos3dvMESA: procedure(var p: GLdouble);
   glWindowPos4iMESA: procedure(x, y, z, w: LongInt);
   glWindowPos4sMESA: procedure(x, y, z, w: ShortInt);
-  glWindowPos4fMESA: procedure(x, y, z, w: Single);
-  glWindowPos4dMESA: procedure(x, y, z, w: Double);
+  glWindowPos4fMESA: procedure(x, y, z, w: GLfloat);
+  glWindowPos4dMESA: procedure(x, y, z, w: GLdouble);
   glWindowPos4ivMESA: procedure(var p: LongInt);
   glWindowPos4svMESA: procedure(var p: ShortInt);
-  glWindowPos4fvMESA: procedure(var p: Single);
-  glWindowPos4dvMESA: procedure(var p: Double);
+  glWindowPos4fvMESA: procedure(var p: GLfloat);
+  glWindowPos4dvMESA: procedure(var p: GLdouble);
 
   // GL_MESA_resize_buffers
   glResizeBuffersMESA: procedure;

+ 96 - 55
packages/opengl/build/glu.def

@@ -25,29 +25,40 @@ const
   GLU_INSIDE                            = 100021;
 
   // Tesselator
-  GLU_BEGIN                             = 100100;
-  GLU_VERTEX                            = 100101;
-  GLU_END                               = 100102;
-  GLU_ERROR                             = 100103;
-  GLU_EDGE_FLAG                         = 100104;
-
-  // Contour types
-  GLU_CW                                = 100120;
-  GLU_CCW                               = 100121;
-  GLU_INTERIOR                          = 100122;
-  GLU_EXTERIOR                          = 100123;
-  GLU_UNKNOWN                           = 100124;
-
-  // Tesselation errors
-  GLU_TESS_ERROR1                       = 100151;  // missing gluEndPolygon
-  GLU_TESS_ERROR2                       = 100152;  // missing gluBeginPolygon
-  GLU_TESS_ERROR3                       = 100153;  // misoriented contour
-  GLU_TESS_ERROR4                       = 100154;  // vertex/edge intersection
-  GLU_TESS_ERROR5                       = 100155;  // misoriented or self-intersecting loops
-  GLU_TESS_ERROR6                       = 100156;  // coincident vertices
-  GLU_TESS_ERROR7                       = 100157;  // all vertices collinear
-  GLU_TESS_ERROR8                       = 100158;  // intersecting edges
-  GLU_TESS_ERROR9                       = 100159;  // not coplanar contours
+  GLU_TESS_BEGIN                        = 100100;
+  GLU_TESS_VERTEX                       = 100101;
+  GLU_TESS_END                          = 100102;
+  GLU_TESS_ERROR                        = 100103;
+  GLU_TESS_EDGE_FLAG                    = 100104;
+  GLU_TESS_COMBINE			= 100105;
+  GLU_TESS_BEGIN_DATA			= 100106;
+  GLU_TESS_VERTEX_DATA			= 100107;
+  GLU_TESS_END_DATA			= 100108;
+  GLU_TESS_ERROR_DATA			= 100109;
+  GLU_TESS_EDGE_FLAG_DATA		= 100110;
+  GLU_TESS_COMBINE_DATA			= 100111;
+
+  // Winding rules
+  GLU_TESS_WINDING_ODD			= 100130;
+  GLU_TESS_WINDING_NONZERO		= 100131;
+  GLU_TESS_WINDING_POSITIVE		= 100132;
+  GLU_TESS_WINDING_NEGATIVE		= 100133;
+  GLU_TESS_WINDING_ABS_GEQ_TWO		= 100134;
+
+  // Tessellation properties
+  GLU_TESS_WINDING_RULE			= 100140;
+  GLU_TESS_BOUNDARY_ONLY		= 100141;
+  GLU_TESS_TOLERANCE			= 100142;
+
+  // Tessellation errors
+  GLU_TESS_ERROR1			= 100151;   // Missing gluBeginPolygon
+  GLU_TESS_ERROR2			= 100152;   // Missing gluBeginContour
+  GLU_TESS_ERROR3			= 100153;   // Missing gluEndPolygon
+  GLU_TESS_ERROR4			= 100154;   // Missing gluEndContour
+  GLU_TESS_ERROR5			= 100155;
+  GLU_TESS_ERROR6			= 100156;
+  GLU_TESS_ERROR7			= 100157;
+  GLU_TESS_ERROR8			= 100158;
 
   // NURBS
   GLU_AUTO_LOAD_MATRIX                  = 100200;
@@ -117,22 +128,44 @@ const
   GLU_VERSION                           = 100800;
   GLU_EXTENSIONS                        = 100801;
 
+
+  // === GLU 1.0 tessellation - obsolete! ===
+
+  // Contour types
+  GLU_CW                                = 100120;
+  GLU_CCW                               = 100121;
+  GLU_INTERIOR                          = 100122;
+  GLU_EXTERIOR                          = 100123;
+  GLU_UNKNOWN                           = 100124;
+
+  // Tessellator
+  GLU_BEGIN				= GLU_TESS_BEGIN;
+  GLU_VERTEX				= GLU_TESS_VERTEX;
+  GLU_END				= GLU_TESS_END;
+  GLU_ERROR				= GLU_TESS_ERROR;
+  GLU_EDGE_FLAG				= GLU_TESS_EDGE_FLAG;
+
+
 type
   PGLUquadricObj = ^TGLUquadricObj;
   TGLUquadricObj = record end;
-  PGLUtriangulatorObj = ^TGLUtriangulatorObj;
-  TGLUtriangulatorObj = record end;
   PGLUnurbsObj = ^TGLUnurbsObj;
   TGLUnurbsObj = record end;
+  PGLUtesselator = ^TGLUtesselator;
+  TGLUtesselator = record end;
+  PGLUtriangulatorObj = PGLUtesselator;
 
+  // Callback function declarations
   TGLUQuadricCallback = procedure; cdecl;
   TGLUNurbsCallback = procedure; cdecl;
   TGLUTessCallback = procedure; cdecl;
 
+  // We need some private array types
   TGLUViewport = array[0..3] of LongInt;
-  TGLUMatrixd = array[0..15] of Double;
-  TGLUMatrixf = array[0..15] of Single;
-  TGLUVectord = array[0..2] of Double;
+  TGLUMatrixd = array[0..15] of GLdouble;
+  TGLUMatrixf = array[0..15] of GLfloat;
+  TGLUVectord = array[0..2] of GLdouble;
+
 var
 %END
 
@@ -143,18 +176,18 @@ var
 
 %PROCS
   // Miscellaneous functions
-  gluLookAt: procedure(eye, eyey, eyez, centerx, centery, centerz, upx, upy, upz: Double);
-  gluOrtho2D: procedure(left, right, bottom, top: Double);
-  gluPerspective: procedure(fovy, aspect, zNear, zFar: Double);
-  gluPickMatrix: procedure(x, y, width, height: Double; const viewport: TGLUViewport);
-  gluProject: procedure(objx, objy, objz: Double; const modelMatrix, projMatrix: TGLUMatrixd; const viewport: TGLUViewport; winx, winy, winz: Double);
-  gluUnProject: procedure(winx, winy, winz: Double; const modelMatrix, projMatrix: TGLUMatrixd; const viewport: TGLUViewport; objx, objy, objz: Double);
-  gluErrorString: procedure(errorCode: GLenum);
+  gluLookAt: procedure(eye, eyey, eyez, centerx, centery, centerz, upx, upy, upz: GLdouble);
+  gluOrtho2D: procedure(left, right, bottom, top: GLdouble);
+  gluPerspective: procedure(fovy, aspect, zNear, zFar: GLdouble);
+  gluPickMatrix: procedure(x, y, width, height: GLdouble; const viewport: TGLUViewport);
+  gluProject: function(objx, objy, objz: GLdouble; const modelMatrix, projMatrix: TGLUMatrixd; const viewport: TGLUViewport; var winx, winy, winz: GLdouble): LongInt;
+  gluUnProject: function(winx, winy, winz: GLdouble; const modelMatrix, projMatrix: TGLUMatrixd; const viewport: TGLUViewport; var objx, objy, objz: GLdouble): LongInt;
+  gluErrorString: function(errorCode: GLenum): PChar;
 
   // Mipmapping and image scaling
-  gluScaleImage: procedure(format: GLenum; within, heightin: LongInt; typein: GLenum; var datain; widthout, heightout: LongInt; typeout: GLenum; var dataout);
-  gluBuild1DMipmaps: procedure(target: GLenum; components, width: LongInt; format, AType: GLEnum; var data);
-  gluBuild2DMipmaps: procedure(target: GLenum; components, width, height: LongInt; format, AType: GLEnum; var data);
+  gluScaleImage: procedure(format: GLenum; within, heightin: LongInt; typein: GLenum; const datain; widthout, heightout: LongInt; typeout: GLenum; var dataout);
+  gluBuild1DMipmaps: procedure(target: GLenum; components, width: LongInt; format, AType: GLEnum; const data);
+  gluBuild2DMipmaps: procedure(target: GLenum; components, width, height: LongInt; format, AType: GLEnum; const data);
 
   // Quadrics
   gluNewQuadric: function: PGLUquadricObj;
@@ -164,37 +197,45 @@ var
   gluQuadricNormals: procedure(quadObject: PGLUquadricObj; normals: GLenum);
   gluQuadricTexture: procedure(quadObject: PGLUquadricObj; textureCoords: Boolean);
   gluQuadricCallback: procedure(quadObject: PGLUquadricObj; which: GLenum; fn: TGLUQuadricCallback);
-  gluCylinder: procedure(qobj: PGLUquadricObj; baseRadius, topRadius, height: Double; slices, stacks: LongInt);
-  gluSphere: procedure(qobj: PGLUquadricObj; radius: Double; slices, stacks: LongInt);
-  gluDisk: procedure(qobj: PGLUquadricObj; innerRadius, outerRadius: Double; slices, loops: LongInt);
-  gluPartialDisk: procedure(qobj: PGLUquadricObj; innerRadius, outerRadius: Double; slices, loops: LongInt; startAngle, sweepAngle: Double);
+  gluCylinder: procedure(qobj: PGLUquadricObj; baseRadius, topRadius, height: GLdouble; slices, stacks: LongInt);
+  gluSphere: procedure(qobj: PGLUquadricObj; radius: GLdouble; slices, stacks: LongInt);
+  gluDisk: procedure(qobj: PGLUquadricObj; innerRadius, outerRadius: GLdouble; slices, loops: LongInt);
+  gluPartialDisk: procedure(qobj: PGLUquadricObj; innerRadius, outerRadius: GLdouble; slices, loops: LongInt; startAngle, sweepAngle: GLdouble);
 
   // Nurbs
   gluNewNurbsRenderer: function: PGLUnurbsObj;
   gluDeleteNurbsRenderer: procedure(nobj: PGLUnurbsObj);
   gluLoadSamplingMatrices: procedure(nobj: PGLUnurbsObj; const modelMatrix, projMatrix: TGLUMatrixf; const viewport: TGLUViewport);
-  gluNurbsProperty: procedure(nobj: PGLUnurbsObj; AProperty: GLenum; value: Single);
-  gluGetNurbsProperty: procedure(nobj: PGLUnurbsObj; AProperty: GLEnum; var value: Single);
+  gluNurbsProperty: procedure(nobj: PGLUnurbsObj; AProperty: GLenum; value: GLfloat);
+  gluGetNurbsProperty: procedure(nobj: PGLUnurbsObj; AProperty: GLEnum; var value: GLfloat);
   gluBeginCurve: procedure(nobj: PGLUnurbsObj);
   gluEndCurve: procedure(nobj: PGLUnurbsObj);
-  gluNurbsCurve: procedure(nobj: PGLUnurbsObj; nknots: LongInt; var know: Single; stride: LongInt; var ctlarray: Single; order: LongInt; AType: GLenum);
+  gluNurbsCurve: procedure(nobj: PGLUnurbsObj; nknots: LongInt; var know: GLfloat; stride: LongInt; var ctlarray: GLfloat; order: LongInt; AType: GLenum);
   gluBeginSurface: procedure(nobj: PGLUnurbsObj);
   gluEndSurface: procedure(nobj: PGLUnurbsObj);
-  gluNurbsSurface: procedure(nobj: PGLUnurbsObj; sknot_count: LongInt; var sknot: Single; tknot_count: LongInt; var tknot: Single; s_stride, t_stride: LongInt; var ctlarray: Single; sorder, torder: LongInt; AType: GLenum);
+  gluNurbsSurface: procedure(nobj: PGLUnurbsObj; sknot_count: LongInt; var sknot: GLfloat; tknot_count: LongInt; var tknot: GLfloat; s_stride, t_stride: LongInt; var ctlarray: GLfloat; sorder, torder: LongInt; AType: GLenum);
   gluBeginTrim: procedure(nobj: PGLUnurbsObj);
   gluEndTrim: procedure(nobj: PGLUnurbsObj);
-  gluPwlCurve: procedure(nobj: PGLUnurbsObj; count: LongInt; var AArray: Single; stride: LongInt; AType: GLenum);
+  gluPwlCurve: procedure(nobj: PGLUnurbsObj; count: LongInt; var AArray: GLfloat; stride: LongInt; AType: GLenum);
   gluNurbsCallback: procedure(nobj: PGLUnurbsObj; which: GLenum; fn: TGLUNurbsCallback);
 
   // Polygon tesselation
-  gluNewTess: function: PGLUtriangulatorObj;
-  gluTessCallback: procedure(tobj: PGLUtriangulatorObj; which: GLenum; fn: TGLUTessCallback);
-
-  gluDeleteTess: procedure(tobj: PGLUtriangulatorObj);
-  gluBeginPolygon: procedure(tobj: PGLUtriangulatorObj);
-  gluEndPolygon: procedure(tobj: PGLUtriangulatorObj);
-  gluNextContour: procedure(tobj: PGLUtriangulatorObj; AType: GLenum);
-  gluTessVertex: procedure(tobj: PGLUtriangulatorObj; v: TGLUVectord; var data);
+  gluNewTess: function: PGLUtesselator;
+  gluDeleteTess: procedure(tobj: PGLUtesselator);
+  gluTessBeginPolygon: procedure(tobj: PGLUtesselator; var polygon_data);
+  gluTessBeginContour: procedure(tobj: PGLUtesselator);
+  gluTessVertex: procedure(tobj: PGLUtesselator; v: TGLUVectord; var data);
+  gluTessEndContour: procedure(tobj: PGLUtesselator);
+  gluTessEndPolygon: procedure(tobj: PGLUtesselator);
+  gluTessProperty: procedure(tobj: PGLUtesselator; which: GLenum; value: GLdouble);
+  gluTessNormal: procedure(tobj: PGLUtesselator; x, y, z: GLdouble);
+  gluTessCallback: procedure(tobj: PGLUtesselator; which: GLenum; fn: TGLUTessCallback);
+  gluGetTessProperty: procedure(tobj: PGLUtesselator; which: GLenum; var value: GLdouble);
+
+  // Obsolete 1.0 tessellation functions
+  gluBeginPolygon: procedure(tobj: PGLUtesselator);
+  gluNextContour: procedure(tobj: PGLUtesselator; AType: GLenum);
+  gluEndPolygon: procedure(tobj: PGLUtesselator);
 
   // New functions in GLU 1.1
   gluGetString: function(name: GLenum): PChar;

+ 376 - 63
packages/opengl/build/glut.def

@@ -1,6 +1,275 @@
 # This is the definition file for all GLUT stuff
 
 %COPY_INTERFACE
+
+{ GLUT API revision history:
+ 
+  GLUT_API_VERSION is updated to reflect incompatible GLUT
+  API changes (interface changes, semantic changes, deletions,
+  or additions).
+ 
+  GLUT_API_VERSION=1  First public release of GLUT.  11/29/94
+
+  GLUT_API_VERSION=2  Added support for OpenGL/GLX multisampling,
+  extension.  Supports new input devices like tablet, dial and button
+  box, and Spaceball.  Easy to query OpenGL extensions.
+
+  GLUT_API_VERSION=3  glutMenuStatus added.
+
+  GLUT_API_VERSION=4  glutInitDisplayString, glutWarpPointer,
+  glutBitmapLength, glutStrokeLength, glutWindowStatusFunc, dynamic
+  video resize subAPI, glutPostWindowRedisplay, glutKeyboardUpFunc,
+  glutSpecialUpFunc, glutIgnoreKeyRepeat, glutSetKeyRepeat,
+  glutJoystickFunc, glutForceJoystickFunc (NOT FINALIZED!). }
+
+const
+  GLUT_API_VERSION		= 4;
+
+  // Display mode bit masks
+  GLUT_RGB                      = 0;
+  GLUT_RGBA                     = GLUT_RGB;
+  GLUT_INDEX                    = 1;
+  GLUT_SINGLE                   = 0;
+  GLUT_DOUBLE                   = 2;
+  GLUT_ACCUM                    = 4;
+  GLUT_ALPHA                    = 8;
+  GLUT_DEPTH                    = 16;
+  GLUT_STENCIL                  = 32;
+  GLUT_MULTISAMPLE              = 128;
+  GLUT_STEREO                   = 256;
+  GLUT_LUMINANCE                = 512;
+
+  // Mouse buttons
+  GLUT_LEFT_BUTTON              = 0;
+  GLUT_MIDDLE_BUTTON            = 1;
+  GLUT_RIGHT_BUTTON             = 2;
+
+  // Mouse button state
+  GLUT_DOWN                     = 0;
+  GLUT_UP                       = 1;
+
+  // function keys
+  GLUT_KEY_F1			= 1;
+  GLUT_KEY_F2			= 2;
+  GLUT_KEY_F3			= 3;
+  GLUT_KEY_F4			= 4;
+  GLUT_KEY_F5			= 5;
+  GLUT_KEY_F6			= 6;
+  GLUT_KEY_F7			= 7;
+  GLUT_KEY_F8			= 8;
+  GLUT_KEY_F9			= 9;
+  GLUT_KEY_F10			= 10;
+  GLUT_KEY_F11			= 11;
+  GLUT_KEY_F12			= 12;
+  // directional keys
+  GLUT_KEY_LEFT			= 100;
+  GLUT_KEY_UP			= 101;
+  GLUT_KEY_RIGHT		= 102;
+  GLUT_KEY_DOWN			= 103;
+  GLUT_KEY_PAGE_UP		= 104;
+  GLUT_KEY_PAGE_DOWN		= 105;
+  GLUT_KEY_HOME			= 106;
+  GLUT_KEY_END			= 107;
+  GLUT_KEY_INSERT		= 108;
+
+  // Enter / exit state
+  GLUT_LEFT                     = 0;
+  GLUT_ENTERED                  = 1;
+
+  // Menu usage state
+  GLUT_MENU_NOT_IN_USE          = 0;
+  GLUT_MENU_IN_USE              = 1;
+
+  // Visibility state
+  GLUT_NOT_VISIBLE              = 0;
+  GLUT_VISIBLE                  = 1;
+
+  // Window status state
+  GLUT_HIDDEN                   = 0;
+  GLUT_FULLY_RETAINED           = 1;
+  GLUT_PARTIALLY_RETAINED       = 2;
+  GLUT_FULLY_COVERED            = 3;
+
+  // Color index component selection values
+  GLUT_RED                      = 0;
+  GLUT_GREEN                    = 1;
+  GLUT_BLUE                     = 2;
+
+  // Layers for use
+  GLUT_NORMAL                   = 0;
+  GLUT_OVERLAY                  = 1;
+
+  // glutGet parameters
+  GLUT_WINDOW_X                 = 100;
+  GLUT_WINDOW_Y                 = 101;
+  GLUT_WINDOW_WIDTH             = 102;
+  GLUT_WINDOW_HEIGHT            = 103;
+  GLUT_WINDOW_BUFFER_SIZE       = 104;
+  GLUT_WINDOW_STENCIL_SIZE      = 105;
+  GLUT_WINDOW_DEPTH_SIZE        = 106;
+  GLUT_WINDOW_RED_SIZE          = 107;
+  GLUT_WINDOW_GREEN_SIZE        = 108;
+  GLUT_WINDOW_BLUE_SIZE         = 109;
+  GLUT_WINDOW_ALPHA_SIZE        = 110;
+  GLUT_WINDOW_ACCUM_RED_SIZE    = 111;
+  GLUT_WINDOW_ACCUM_GREEN_SIZE  = 112;
+  GLUT_WINDOW_ACCUM_BLUE_SIZE   = 113;
+  GLUT_WINDOW_ACCUM_ALPHA_SIZE  = 114;
+  GLUT_WINDOW_DOUBLEBUFFER      = 115;
+  GLUT_WINDOW_RGBA              = 116;
+  GLUT_WINDOW_PARENT            = 117;
+  GLUT_WINDOW_NUM_CHILDREN      = 118;
+  GLUT_WINDOW_COLORMAP_SIZE     = 119;
+  GLUT_WINDOW_NUM_SAMPLES       = 120;
+  GLUT_WINDOW_STEREO            = 121;
+  GLUT_WINDOW_CURSOR            = 122;
+  GLUT_SCREEN_WIDTH             = 200;
+  GLUT_SCREEN_HEIGHT            = 201;
+  GLUT_SCREEN_WIDTH_MM          = 202;
+  GLUT_SCREEN_HEIGHT_MM         = 203;
+  GLUT_MENU_NUM_ITEMS           = 300;
+  GLUT_DISPLAY_MODE_POSSIBLE    = 400;
+  GLUT_INIT_WINDOW_X            = 500;
+  GLUT_INIT_WINDOW_Y            = 501;
+  GLUT_INIT_WINDOW_WIDTH        = 502;
+  GLUT_INIT_WINDOW_HEIGHT       = 503;
+  GLUT_INIT_DISPLAY_MODE        = 504;
+  GLUT_ELAPSED_TIME             = 700;
+  GLUT_WINDOW_FORMAT_ID         = 123;
+
+  // glutDeviceGet parameters
+  GLUT_HAS_KEYBOARD             = 600;
+  GLUT_HAS_MOUSE                = 601;
+  GLUT_HAS_SPACEBALL            = 602;
+  GLUT_HAS_DIAL_AND_BUTTON_BOX  = 603;
+  GLUT_HAS_TABLET               = 604;
+  GLUT_NUM_MOUSE_BUTTONS        = 605;
+  GLUT_NUM_SPACEBALL_BUTTONS    = 606;
+  GLUT_NUM_BUTTON_BOX_BUTTONS   = 607;
+  GLUT_NUM_DIALS                = 608;
+  GLUT_NUM_TABLET_BUTTONS       = 609;
+  GLUT_DEVICE_IGNORE_KEY_REPEAT = 610;
+  GLUT_DEVICE_KEY_REPEAT        = 611;
+  GLUT_HAS_JOYSTICK             = 612;
+  GLUT_OWNS_JOYSTICK            = 613;
+  GLUT_JOYSTICK_BUTTONS         = 614;
+  GLUT_JOYSTICK_AXES            = 615;
+  GLUT_JOYSTICK_POLL_RATE       = 616;
+
+  // glutLayerGet parameters
+  GLUT_OVERLAY_POSSIBLE         = 800;
+  GLUT_LAYER_IN_USE             = 801;
+  GLUT_HAS_OVERLAY              = 802;
+  GLUT_TRANSPARENT_INDEX        = 803;
+  GLUT_NORMAL_DAMAGED           = 804;
+  GLUT_OVERLAY_DAMAGED          = 805;
+
+  // glutVideoResizeGet parameters
+  GLUT_VIDEO_RESIZE_POSSIBLE    = 900;
+  GLUT_VIDEO_RESIZE_IN_USE      = 901;
+  GLUT_VIDEO_RESIZE_X_DELTA     = 902;
+  GLUT_VIDEO_RESIZE_Y_DELTA     = 903;
+  GLUT_VIDEO_RESIZE_WIDTH_DELTA = 904;
+  GLUT_VIDEO_RESIZE_HEIGHT_DELTA= 905;
+  GLUT_VIDEO_RESIZE_X           = 906;
+  GLUT_VIDEO_RESIZE_Y           = 907;
+  GLUT_VIDEO_RESIZE_WIDTH       = 908;
+  GLUT_VIDEO_RESIZE_HEIGHT      = 909;
+
+  // glutGetModifiers return mask
+  GLUT_ACTIVE_SHIFT             = 1;
+  GLUT_ACTIVE_CTRL              = 2;
+  GLUT_ACTIVE_ALT               = 4;
+
+  // glutSetCursor parameters
+  // Basic arrows
+  GLUT_CURSOR_RIGHT_ARROW	= 0;
+  GLUT_CURSOR_LEFT_ARROW	= 1;
+  // Symbolic cursor shapes
+  GLUT_CURSOR_INFO		= 2;
+  GLUT_CURSOR_DESTROY		= 3;
+  GLUT_CURSOR_HELP		= 4;
+  GLUT_CURSOR_CYCLE		= 5;
+  GLUT_CURSOR_SPRAY		= 6;
+  GLUT_CURSOR_WAIT		= 7;
+  GLUT_CURSOR_TEXT		= 8;
+  GLUT_CURSOR_CROSSHAIR		= 9;
+  // Directional cursors
+  GLUT_CURSOR_UP_DOWN		= 10;
+  GLUT_CURSOR_LEFT_RIGHT	= 11;
+  // Sizing cursors
+  GLUT_CURSOR_TOP_SIDE		= 12;
+  GLUT_CURSOR_BOTTOM_SIDE	= 13;
+  GLUT_CURSOR_LEFT_SIDE		= 14;
+  GLUT_CURSOR_RIGHT_SIDE	= 15;
+  GLUT_CURSOR_TOP_LEFT_CORNER	= 16;
+  GLUT_CURSOR_TOP_RIGHT_CORNER	= 17;
+  GLUT_CURSOR_BOTTOM_RIGHT_CORNER = 18;
+  GLUT_CURSOR_BOTTOM_LEFT_CORNER = 19;
+  // Inherit from parent window
+  GLUT_CURSOR_INHERIT		= 100;
+  // Blank cursor
+  GLUT_CURSOR_NONE		= 101;
+  // Fullscreen crosshair (if available)
+  GLUT_CURSOR_FULL_CROSSHAIR	= 102;
+
+type
+
+  // GLUT menu sub-API
+  TGlutCreateMenuFunc = procedure(arg: Int); cdecl;
+
+  // GLUT window callback sub-API
+  TGlutDisplayFunc = procedure; cdecl;
+  TGlutReshapeFunc = procedure(width, height: Int); cdecl;
+  TGlutKeyboardFunc = procedure(key: Char; x, y: Int); cdecl;
+  TGlutMouseFunc = procedure(button, state, x, y: Int); cdecl;
+  TGlutMotionFunc = procedure(x, y: Int); cdecl;
+  TGlutPassiveMotionFunc = procedure(x, y: Int); cdecl;
+  TGlutEntryFunc = procedure(x, y: Int); cdecl;
+  TGlutVisibilityFunc = procedure(state: Int); cdecl;
+  TGlutIdleFunc = procedure; cdecl;
+  TGlutTimerFunc = procedure(value: Int); cdecl;
+  TGlutMenuStateFunc = procedure(state: Int); cdecl;
+  TGlutSpecialFunc = procedure(key, x, y: Int); cdecl;
+  TGlutSpaceballMotionFunc = procedure(x, y, z: Int); cdecl;
+  TGlutSpaceballRotateFunc = procedure(x, y, z: Int); cdecl;
+  TGlutSpaceballButtonFunc = procedure(button, state: Int); cdecl;
+  TGlutButtonBoxFunc = procedure(button, state: Int); cdecl;
+  TGlutDialsFunc = procedure(dial, value: Int); cdecl;
+  TGlutTabletMotionFunc = procedure(x, y: Int); cdecl;
+  TGlutTabletButtonFunc = procedure(button, state, x, y: Int); cdecl;
+  TGlutMenuStatusFunc = procedure(status, x, y: Int); cdecl;
+  TGlutOverlayDisplayFunc = procedure; cdecl;
+  TGlutWindowStatusFunc = procedure(state: Int); cdecl;
+  TGlutKeyboardUpFunc = procedure(key: Char; x, y: Int); cdecl;
+  TGlutSpecialUpFunc = procedure(key, x, y: Int); cdecl;
+  TGlutJoystickFunc = procedure(buttonMask: UnsignedInt; x, y, z: Int); cdecl;
+
+const
+// GLUT device control sub-API
+  // glutSetKeyRepeat modes.
+  GLUT_KEY_REPEAT_OFF		= 0;
+  GLUT_KEY_REPEAT_ON		= 1;
+  GLUT_KEY_REPEAT_DEFAULT	= 2;
+
+  // Joystick button masks
+  GLUT_JOYSTICK_BUTTON_A	= 1;
+  GLUT_JOYSTICK_BUTTON_B	= 2;
+  GLUT_JOYSTICK_BUTTON_C	= 4;
+  GLUT_JOYSTICK_BUTTON_D	= 8;
+
+// GLUT game mode sub-API
+  // glutGameModeGet
+  GLUT_GAME_MODE_ACTIVE         = 0;
+  GLUT_GAME_MODE_POSSIBLE       = 1;
+  GLUT_GAME_MODE_WIDTH          = 2;
+  GLUT_GAME_MODE_HEIGHT         = 3;
+  GLUT_GAME_MODE_PIXEL_DEPTH    = 4;
+  GLUT_GAME_MODE_REFRESH_RATE   = 5;
+  GLUT_GAME_MODE_DISPLAY_CHANGED= 6;
+
+
+var
 %END
 
 
@@ -10,98 +279,142 @@
 
 %PROCS
 // GLUT initialization sub-API
-  glutInit: procedure(var argcp: Integer; var argv: PChar);
-  glutInitDisplayMode: procedure(mode: LongWord);
-  glutInitDisplayString: procedure(AString: PChar);
-  glutInitWindowPosition: procedure(x, y: Integer);
-  glutInitWindowSize: procedure(width, height: Integer);
+  glutInit: procedure(argcp: PInt; argv: PPChar);
+  glutInitDisplayMode: procedure(mode: UnsignedInt);
+  glutInitDisplayString: procedure(const AString: PChar);
+  glutInitWindowPosition: procedure(x, y: Int);
+  glutInitWindowSize: procedure(width, height: Int);
   glutMainLoop: procedure;
 
 // GLUT window sub-API
-  glutCreateWindow: function(title: PChar): Integer;
-  glutCreateSubWindow: function(win, x, y, width, height: Integer): Integer;
-  glutDestroyWindow: procedure(win: Integer);
+  glutCreateWindow: function(const title: PChar): Int;
+  glutCreateSubWindow: function(win, x, y, width, height: Int): Int;
+  glutDestroyWindow: procedure(win: Int);
   glutPostRedisplay: procedure;
-  glutPostWindowRedisplay: procedure(win: Integer);
+  glutPostWindowRedisplay: procedure(win: Int);
   glutSwapBuffers: procedure;
-  glutGetWindow: function: Integer;
-  glutSetWindow: procedure(win: Integer);
-  glutSetWindowTitle: procedure(title: PChar);
+  glutGetWindow: function: Int;
+  glutSetWindow: procedure(win: Int);
+  glutSetWindowTitle: procedure(const title: PChar);
   glutSetIconTitle: procedure(title: PChar);
-  glutPositionWindow: procedure(x, y: Integer);
-  glutReshapeWindow: procedure(width, height: Integer);
+  glutPositionWindow: procedure(x, y: Int);
+  glutReshapeWindow: procedure(width, height: Int);
   glutPopWindow: procedure;
   glutPushWindow: procedure;
   glutIconifyWindow: procedure;
   glutShowWindow: procedure;
   glutHideWindow: procedure;
   glutFullScreen: procedure;
-  glutSetCursor: procedure(cursor: Integer);
-  glutWarpPointer: procedure(x, y: Integer);
+  glutSetCursor: procedure(cursor: Int);
+  glutWarpPointer: procedure(x, y: Int);
 
-//overlays ###
+// GLUT overlay sub-API
+  glutEstablishOverlay: procedure;
+  glutRemoveOverlay: procedure;
+  glutUseLayer: procedure(layer: GLenum);
+  glutPostOverlayRedisplay: procedure;
+  glutPostWindowOverlayRedisplay: procedure(win: Int);
+  glutShowOverlay: procedure;
+  glutHideOverlay: procedure;
 
-//menus ###
+// GLUT menu sub-API
+  glutCreateMenu: function(func: TGlutCreateMenuFunc): Int;
+  glutDestroyMenu: procedure(menu: Int);
+  glutGetMenu: function: Int;
+  glutSetMenu: procedure(menu: Int);
+  glutAddMenuEntry: procedure(const ALabel: PChar; value: Int);
+  glutAddSubMenu: procedure(const ALabel: PChar; submenu: Int);
+  glutChangeToMenuEntry: procedure(item: Int; const ALabel: PChar; value: Int);
+  glutChangeToSubMenu: procedure(item: Int; const ALabel: PChar; submenu: Int);
+  glutRemoveMenuItem: procedure(item: Int);
+  glutAttachMenu: procedure(button: Int);
+  glutDetachMenu: procedure(button: Int);
 
 // GLUT window callback sub-API
   glutDisplayFunc: procedure(func: TGlutDisplayFunc);
   glutReshapeFunc: procedure(func: TGlutReshapeFunc);
-
-  glutTimerFunc: procedure(millis: LongWord; func: TGlutTimerFunc; value: Integer);
-
-
-// GLUTAPI void APIENTRY glutDisplayFunc(void (GLUTCALLBACK * func)(void));
-// GLUTAPI void APIENTRY glutReshapeFunc(void (GLUTCALLBACK * func)(int width, int height));
-// GLUTAPI void APIENTRY glutKeyboardFunc(void (GLUTCALLBACK * func)(unsigned char key, int x, int y));
-// GLUTAPI void APIENTRY glutMouseFunc(void (GLUTCALLBACK * func)(int button, int state, int x, int y));
-// GLUTAPI void APIENTRY glutMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
-// GLUTAPI void APIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
-// GLUTAPI void APIENTRY glutEntryFunc(void (GLUTCALLBACK * func)(int state));
-// GLUTAPI void APIENTRY glutVisibilityFunc(void (GLUTCALLBACK * func)(int state));
-// GLUTAPI void APIENTRY glutIdleFunc(void (GLUTCALLBACK * func)(void));
-// GLUTAPI void APIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK * func)(int value), int value);
-// GLUTAPI void APIENTRY glutMenuStateFunc(void (GLUTCALLBACK * func)(int state));
-// GLUTAPI void APIENTRY glutSpecialFunc(void (GLUTCALLBACK * func)(int key, int x, int y));
-// GLUTAPI void APIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK * func)(int x, int y, int z));
-// GLUTAPI void APIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK * func)(int x, int y, int z));
-// GLUTAPI void APIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK * func)(int button, int state));
-// GLUTAPI void APIENTRY glutButtonBoxFunc(void (GLUTCALLBACK * func)(int button, int state));
-// GLUTAPI void APIENTRY glutDialsFunc(void (GLUTCALLBACK * func)(int dial, int value));
-// GLUTAPI void APIENTRY glutTabletMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
-// GLUTAPI void APIENTRY glutTabletButtonFunc(void (GLUTCALLBACK * func)(int button, int state, int x, int y));
-// GLUTAPI void APIENTRY glutMenuStatusFunc(void (GLUTCALLBACK * func)(int status, int x, int y));
-// GLUTAPI void APIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK * func)(void));
-// GLUTAPI void APIENTRY glutWindowStatusFunc(void (GLUTCALLBACK * func)(int state));
-// GLUTAPI void APIENTRY glutKeyboardUpFunc(void (GLUTCALLBACK * func)(unsigned char key, int x, int y));
-// GLUTAPI void APIENTRY glutSpecialUpFunc(void (GLUTCALLBACK * func)(int key, int x, int y));
-// GLUTAPI void APIENTRY glutJoystickFunc(void (GLUTCALLBACK * func)(unsigned int buttonMask, int x, int y, int z), int pollInterval)
+  glutKeyboardFunc: procedure(func: TGlutKeyboardFunc);
+  glutMouseFunc: procedure(func: TGlutMouseFunc);
+  glutMotionFunc: procedure(func: TGlutMotionFunc);
+  glutPassiveMotionFunc: procedure(func: TGlutPassiveMotionFunc);
+  glutEntryFunc: procedure(func: TGlutEntryFunc);
+  glutIdleFunc: procedure(func: TGlutIdleFunc);
+  glutTimerFunc: procedure(millis: UnsignedInt; func: TGlutTimerFunc; value: Int);
+  glutMenuStateFunc: procedure(func: TGlutMenuStateFunc);
+  glutSpecialFunc: procedure(func: TGlutSpecialFunc);
+  glutSpaceballMotionFunc: procedure(func: TGlutSpaceballMotionFunc);
+  glutSpaceballRotateFunc: procedure(func: TGlutSpaceballRotateFunc);
+  glutSpaceballButtonFunc: procedure(func: TGlutSpaceballButtonFunc);
+  glutButtonBoxFunc: procedure(func: TGlutButtonBoxFunc);
+  glutDialsFunc: procedure(func: TGlutDialsFunc);
+  glutTabletMotionFunc: procedure(func: TGlutTabletMotionFunc);
+  glutTabletButtonFunc: procedure(func: TGlutTabletButtonFunc);
+  glutMenuStatusFunc: procedure(func: TGlutMenuStatusFunc);
+  glutOverlayDisplayFunc: procedure(func: TGlutOverlayDisplayFunc);
+  glutWindowStatusFunc: procedure(func: TGlutWindowStatusFunc);
+  glutKeyboardUpFunc: procedure(func: TGlutKeyboardUpFunc);
+  glutSpecialUpFunc: procedure(func: TGlutSpecialUpFunc);
+  glutJoystickFunc: procedure(func: TGlutJoystickFunc; pollinterval: Int);
 
 // GLUT color index sub-API
-  glutSetColor: procedure(index: Integer; red, green, blue: Single);
-  glutGetColor: function(ndx, component: Integer): Single;
-  glutCopyColormap: procedure(win: Integer);
+  glutSetColor: procedure(index: Int; red, green, blue: GLfloat);
+  glutGetColor: function(ndx, component: Int): GLfloat;
+  glutCopyColormap: procedure(win: Int);
 
 // GLUT state retrieval sub-API
-  glutGet: function(AType: GLEnum): Integer;
-  glutDeviceGet: function(AType: GLEnum): Integer;
-  glutExtensionSupported: function(name: PChar): Integer;
-  glutGetModifiers: function: Integer;
-  glutLayerGet: function(AType: GLEnum): Integer;
+  glutGet: function(AType: GLEnum): Int;
+  glutDeviceGet: function(AType: GLEnum): Int;
+  glutExtensionSupported: function(const name: PChar): Int;
+  glutGetModifiers: function: Int;
+  glutLayerGet: function(AType: GLEnum): Int;
 
-// fonts ###
+// GLUT font sub-API
+  glutBitmapCharacter: procedure(font: Pointer; character: Int);
+  glutBitmapWidth: function(font: Pointer; character: Int): Int;
+  glutStrokeCharacter: procedure(font: Pointer; character: Int);
+  glutStrokeWidth: function(font: Pointer; character: Int): Int;
+  glutBitmapLength: function(font: Pointer; const AString: PChar): Int;
+  glutStrokeLength: function(font: Pointer; const AString: PChar): Int;
 
-// pre-built models ###
+// GLUT pre-built models sub-API
+  glutWireSphere: procedure(radius: GLdouble; slices, stacks: GLint);
+  glutSolidSphere: procedure(radius: GLdouble; slices, stacks: GLint);
+  glutWireCone: procedure(base: GLdouble; height: GLdouble; slices, stacks: GLint);
+  glutSolidCone: procedure(base: GLdouble; height: GLdouble; slices, stacks: GLint);
+  glutWireCube: procedure(size: GLdouble);
+  glutSolidCube: procedure(size: GLdouble);
+  glutWireTorus: procedure(innerRadius, outerRadius: GLdouble; sides, rings: GLint);
+  glutSolidTorus: procedure(innerRadius, outerRadius: GLdouble; sides, rings: GLint);
+  glutWireDodecahedron: procedure;
+  glutSolidDodecahedron: procedure;
+  glutWireTeapot: procedure(size: GLdouble);
+  glutSolidTeapot: procedure(size: GLdouble);
+  glutWireOctahedron: procedure;
+  glutSolidOctahedron: procedure;
+  glutWireTetrahedron: procedure;
+  glutSolidTetrahedron: procedure;
+  glutWireIcosahedron: procedure;
+  glutSolidIcosahedron: procedure;
 
-// video resize ###
+// GLUT video resize sub-API
+  glutVideoResizeGet: function(param: GLenum): Int;
+  glutSetupVideoResizing: procedure;
+  glutStopVideoResizing: procedure;
+  glutVideoResize: procedure(x, y, width, height: Int);
+  glutVideoPan: procedure(x, y, width, height: Int);
 
-// debugging ###
-
-// device control ###
+// GLUT debugging sub-API
+  glutReportErrors: procedure;
 
+// GLUT device control sub-API
+  glutIgnoreKeyRepeat: procedure(ignore: Int);
+  glutSetKeyRepeat: procedure(repeatMode: Int);
+  glutForceJoystickFunc: procedure;
 
 // GLUT game mode sub-API
-  glutGameModeString: procedure(AString: PChar);
+  glutGameModeString: procedure(const AString: PChar);
   glutEnterGameMode: function: Integer;
   glutLeaveGameMode: procedure;
-  glutGameModeGet: function(mode: GLEnum): Integer;
+  glutGameModeGet: function(mode: GLEnum): Int;
+
 %END

+ 40 - 185
packages/opengl/build/glut_linux.tpl

@@ -1,39 +1,27 @@
 {
   $Id$
 
-  Translation of the Mesa GLUT headers for FreePascal
-  Linux Version, Copyright (C) 1999-2000 Sebastian Guenther
+  Translation of the GLUT 3.7 headers for Free Pascal, Linux version
+  Copyright (C) 1999-2000 Sebastian Guenther, [email protected]
 
 
-  Mesa 3-D graphics library
-  Version:  3.0
-  Copyright (C) 1995-1998  Brian Paul
+  Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1998.
 
-  This library is free software; you can redistribute it and/or
-  modify it under the terms of the GNU Library General Public
-  License as published by the Free Software Foundation; either
-  version 2 of the License, or (at your option) any later version.
-
-  This library is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-  Library General Public License for more details.
-
-  You should have received a copy of the GNU Library General Public
-  License along with this library; if not, write to the Free
-  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+  This program is freely distributable without licensing fees  and is
+  provided without guarantee or warrantee expressed or  implied. This
+  program is -not- in the public domain.
 }
 
 
-{$MODE delphi}
-
 unit GLUT;
 
+{$MODE delphi}
+
 interface
 
 uses GL;
 
-function InitGLUTFromLibrary(libname: PChar): Boolean;
+function InitGLUTFromLibrary(const libname: PChar): Boolean;
 
 // determines automatically which library to use:
 function InitGLUT: Boolean;
@@ -46,169 +34,35 @@ var
     unresolved GLUT functions dumped to the console }
   GLUTDumpUnresolvedFunctions: Boolean;
 
+%GLUTDecls
 
+{ The following stuff does not exist in the Win32 version: }
+(* commented out because cvars don't work in Delphi mode...
+// Stroke font opaque addresses (use constants instead in source code).
+var
+  glutStrokeRoman, glutStrokeMonoRoman: Pointer; cvar; external;
 
-
-const
-  // Display mode bit masks
-  GLUT_RGB                      = 0;
-  GLUT_RGBA                     = GLUT_RGB;
-  GLUT_INDEX                    = 1;
-  GLUT_SINGLE                   = 0;
-  GLUT_DOUBLE                   = 2;
-  GLUT_ACCUM                    = 4;
-  GLUT_ALPHA                    = 8;
-  GLUT_DEPTH                    = 16;
-  GLUT_STENCIL                  = 32;
-  GLUT_MULTISAMPLE              = 128;
-  GLUT_STEREO                   = 256;
-  GLUT_LUMINANCE                = 512;
-
-  // Mouse buttons
-  GLUT_LEFT_BUTTON              = 0;
-  GLUT_MIDDLE_BUTTON            = 1;
-  GLUT_RIGHT_BUTTON             = 2;
-
-  // Mouse button state
-  GLUT_DOWN                     = 0;
-  GLUT_UP                       = 1;
-
-  // Keys ###
-
-  // Enter / exit state
-  GLUT_LEFT                     = 0;
-  GLUT_ENTERED                  = 1;
-
-  // Menu usage state
-  GLUT_MENU_NOT_IN_USE          = 0;
-  GLUT_MENU_IN_USE              = 1;
-
-  // Visibility state
-  GLUT_NOT_VISIBLE              = 0;
-  GLUT_VISIBLE                  = 1;
-
-  // Window status state
-  GLUT_HIDDEN                   = 0;
-  GLUT_FULLY_RETAINED           = 1;
-  GLUT_PARTIALLY_RETAINED       = 2;
-  GLUT_FULLY_COVERED            = 3;
-
-  // Color index component selection values
-  GLUT_RED                      = 0;
-  GLUT_GREEN                    = 1;
-  GLUT_BLUE                     = 2;
-
-  // Layers for use
-  GLUT_NORMAL                   = 0;
-  GLUT_OVERLAY                  = 1;
-
-  // Bitmap stuff###
-
-
-  // glutGet parameters
-  GLUT_WINDOW_X                 = 100;
-  GLUT_WINDOW_Y                 = 101;
-  GLUT_WINDOW_WIDTH             = 102;
-  GLUT_WINDOW_HEIGHT            = 103;
-  GLUT_WINDOW_BUFFER_SIZE       = 104;
-  GLUT_WINDOW_STENCIL_SIZE      = 105;
-  GLUT_WINDOW_DEPTH_SIZE        = 106;
-  GLUT_WINDOW_RED_SIZE          = 107;
-  GLUT_WINDOW_GREEN_SIZE        = 108;
-  GLUT_WINDOW_BLUE_SIZE         = 109;
-  GLUT_WINDOW_ALPHA_SIZE        = 110;
-  GLUT_WINDOW_ACCUM_RED_SIZE    = 111;
-  GLUT_WINDOW_ACCUM_GREEN_SIZE  = 112;
-  GLUT_WINDOW_ACCUM_BLUE_SIZE   = 113;
-  GLUT_WINDOW_ACCUM_ALPHA_SIZE  = 114;
-  GLUT_WINDOW_DOUBLEBUFFER      = 115;
-  GLUT_WINDOW_RGBA              = 116;
-  GLUT_WINDOW_PARENT            = 117;
-  GLUT_WINDOW_NUM_CHILDREN      = 118;
-  GLUT_WINDOW_COLORMAP_SIZE     = 119;
-  GLUT_WINDOW_NUM_SAMPLES       = 120;
-  GLUT_WINDOW_STEREO            = 121;
-  GLUT_WINDOW_CURSOR            = 122;
-  GLUT_SCREEN_WIDTH             = 200;
-  GLUT_SCREEN_HEIGHT            = 201;
-  GLUT_SCREEN_WIDTH_MM          = 202;
-  GLUT_SCREEN_HEIGHT_MM         = 203;
-  GLUT_MENU_NUM_ITEMS           = 300;
-  GLUT_DISPLAY_MODE_POSSIBLE    = 400;
-  GLUT_INIT_WINDOW_X            = 500;
-  GLUT_INIT_WINDOW_Y            = 501;
-  GLUT_INIT_WINDOW_WIDTH        = 502;
-  GLUT_INIT_WINDOW_HEIGHT       = 503;
-  GLUT_INIT_DISPLAY_MODE        = 504;
-  GLUT_ELAPSED_TIME             = 700;
-  GLUT_WINDOW_FORMAT_ID         = 123;
-
-  // glutDeviceGet parameters
-  GLUT_HAS_KEYBOARD             = 600;
-  GLUT_HAS_MOUSE                = 601;
-  GLUT_HAS_SPACEBALL            = 602;
-  GLUT_HAS_DIAL_AND_BUTTON_BOX  = 603;
-  GLUT_HAS_TABLET               = 604;
-  GLUT_NUM_MOUSE_BUTTONS        = 605;
-  GLUT_NUM_SPACEBALL_BUTTONS    = 606;
-  GLUT_NUM_BUTTON_BOX_BUTTONS   = 607;
-  GLUT_NUM_DIALS                = 608;
-  GLUT_NUM_TABLET_BUTTONS       = 609;
-  GLUT_DEVICE_IGNORE_KEY_REPEAT = 610;
-  GLUT_DEVICE_KEY_REPEAT        = 611;
-  GLUT_HAS_JOYSTICK             = 612;
-  GLUT_OWNS_JOYSTICK            = 613;
-  GLUT_JOYSTICK_BUTTONS         = 614;
-  GLUT_JOYSTICK_AXES            = 615;
-  GLUT_JOYSTICK_POLL_RATE       = 616;
-
-  // glutLayerGet parameters
-  GLUT_OVERLAY_POSSIBLE         = 800;
-  GLUT_LAYER_IN_USE             = 801;
-  GLUT_HAS_OVERLAY              = 802;
-  GLUT_TRANSPARENT_INDEX        = 803;
-  GLUT_NORMAL_DAMAGED           = 804;
-  GLUT_OVERLAY_DAMAGED          = 805;
-
-  // glutVideoResizeGet parameters
-  GLUT_VIDEO_RESIZE_POSSIBLE    = 900;
-  GLUT_VIDEO_RESIZE_IN_USE      = 901;
-  GLUT_VIDEO_RESIZE_X_DELTA     = 902;
-  GLUT_VIDEO_RESIZE_Y_DELTA     = 903;
-  GLUT_VIDEO_RESIZE_WIDTH_DELTA = 904;
-  GLUT_VIDEO_RESIZE_HEIGHT_DELTA= 905;
-  GLUT_VIDEO_RESIZE_X           = 906;
-  GLUT_VIDEO_RESIZE_Y           = 907;
-  GLUT_VIDEO_RESIZE_WIDTH       = 908;
-  GLUT_VIDEO_RESIZE_HEIGHT      = 909;
-
-  // glutGetModifiers return mask
-  GLUT_ACTIVE_SHIFT             = 1;
-  GLUT_ACTIVE_CTRL              = 2;
-  GLUT_ACTIVE_ALT               = 4;
-
-  // Cursor stuff ###
-
-// GLUT window callback sub-API
-type
-  TGlutDisplayFunc = procedure; #extdecl;
-  TGlutReshapeFunc = procedure(width, height: Integer); #extdecl;
-
-  TGlutTimerFunc = procedure(value: Integer); #extdecl;
-
-// GLUT game mode sub-API
-// glutGameModeGet
+// Stroke font constants (use these in GLUT program).
 const
-  GLUT_GAME_MODE_ACTIVE         = 0;
-  GLUT_GAME_MODE_POSSIBLE       = 1;
-  GLUT_GAME_MODE_WIDTH          = 2;
-  GLUT_GAME_MODE_HEIGHT         = 3;
-  GLUT_GAME_MODE_PIXEL_DEPTH    = 4;
-  GLUT_GAME_MODE_REFRESH_RATE   = 5;
-  GLUT_GAME_MODE_DISPLAY_CHANGED= 6;
-
+  GLUT_STROKE_ROMAN = @glutStrokeRoman;
+  GLUT_STROKE_MONO_ROMAN = @glutStrokeMonoRoman;
 
+// Bitmap font opaque addresses (use constants instead in source code).
 var
+  glutBitmap9By15, glutBitmap8By13, glutBitmapTimesRoman10,
+    glutBitmapTimesRoman24, glutBitmapHelvetica10, glutBitmapHelvetica12,
+    glutBitmapHelvetica18: Pointer; cdecl; external;
+
+// Bitmap font constants (use these in GLUT program).
+const
+  GLUT_BITMAP_9_BY_15 = @glutBitmap9By15;
+  GLUT_BITMAP_8_BY_13 = @glutBitmap8By13;
+  GLUT_BITMAP_TIMES_ROMAN_10 = @glutBitmapTimesRoman10;
+  GLUT_BITMAP_TIMES_ROMAN_24 = @glutBitmapTimesRoman24;
+  GLUT_BITMAP_HELVETICA_10 = @glutBitmapHelvetica10;
+  GLUT_BITMAP_HELVETICA_12 = @glutBitmapHelvetica12;
+  GLUT_BITMAP_HELVETICA_18 = @glutBitmapHelvetica18;*)
+
 %GLUTProcs1
 
 
@@ -216,11 +70,11 @@ implementation
 
 {$LINKLIB Xmu}
 
-function dlopen(AFile: PChar; mode: LongInt): Pointer; external 'dl';
+function dlopen(const AFile: PChar; mode: LongInt): Pointer; external 'dl';
 function dlclose(handle: Pointer): LongInt; external 'dl';
-function dlsym(handle: Pointer; name: PChar): Pointer; external 'dl';
+function dlsym(handle: Pointer; const name: PChar): Pointer; external 'dl';
 
-function LoadLibrary(name: PChar): Pointer;
+function LoadLibrary(const name: PChar): Pointer;
 begin
   Result := dlopen(name, $101 {RTLD_GLOBAL or RTLD_LAZY});
 end;
@@ -230,7 +84,7 @@ begin
   dlclose(handle);
 end;
 
-function GetProc(handle: Pointer; name: PChar): Pointer;
+function GetProc(handle: Pointer; const name: PChar): Pointer;
 begin
   Result := dlsym(handle, name);
   if not Assigned(Result) and GLUTDumpUnresolvedFunctions then
@@ -240,11 +94,12 @@ end;
 var
   libGLUT: Pointer;
 
-function InitGLUTFromLibrary(libname: PChar): Boolean;
+function InitGLUTFromLibrary(const libname: PChar): Boolean;
 begin
   Result := False;
   libGLUT := LoadLibrary(libname);
-  if not Assigned(libGLUT) then exit;
+  if not Assigned(libGLUT) then
+    exit;
 
 %GLUTProcs2
 

File diff suppressed because it is too large
+ 352 - 271
packages/opengl/linux/gl.pp


+ 350 - 109
packages/opengl/linux/glut.pp

@@ -1,39 +1,27 @@
 {
   $Id$
 
-  Translation of the Mesa GLUT headers for FreePascal
-  Linux Version, Copyright (C) 1999-2000 Sebastian Guenther
+  Translation of the GLUT 3.7 headers for Free Pascal, Linux version
+  Copyright (C) 1999-2000 Sebastian Guenther, [email protected]
 
 
-  Mesa 3-D graphics library
-  Version:  3.0
-  Copyright (C) 1995-1998  Brian Paul
+  Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1998.
 
-  This library is free software; you can redistribute it and/or
-  modify it under the terms of the GNU Library General Public
-  License as published by the Free Software Foundation; either
-  version 2 of the License, or (at your option) any later version.
-
-  This library is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-  Library General Public License for more details.
-
-  You should have received a copy of the GNU Library General Public
-  License along with this library; if not, write to the Free
-  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+  This program is freely distributable without licensing fees  and is
+  provided without guarantee or warrantee expressed or  implied. This
+  program is -not- in the public domain.
 }
 
 
-{$MODE delphi}
-
 unit GLUT;
 
+{$MODE delphi}
+
 interface
 
 uses GL;
 
-function InitGLUTFromLibrary(libname: PChar): Boolean;
+function InitGLUTFromLibrary(const libname: PChar): Boolean;
 
 // determines automatically which library to use:
 function InitGLUT: Boolean;
@@ -47,9 +35,29 @@ var
   GLUTDumpUnresolvedFunctions: Boolean;
 
 
+{ GLUT API revision history:
+ 
+  GLUT_API_VERSION is updated to reflect incompatible GLUT
+  API changes (interface changes, semantic changes, deletions,
+  or additions).
+ 
+  GLUT_API_VERSION=1  First public release of GLUT.  11/29/94
+
+  GLUT_API_VERSION=2  Added support for OpenGL/GLX multisampling,
+  extension.  Supports new input devices like tablet, dial and button
+  box, and Spaceball.  Easy to query OpenGL extensions.
 
+  GLUT_API_VERSION=3  glutMenuStatus added.
+
+  GLUT_API_VERSION=4  glutInitDisplayString, glutWarpPointer,
+  glutBitmapLength, glutStrokeLength, glutWindowStatusFunc, dynamic
+  video resize subAPI, glutPostWindowRedisplay, glutKeyboardUpFunc,
+  glutSpecialUpFunc, glutIgnoreKeyRepeat, glutSetKeyRepeat,
+  glutJoystickFunc, glutForceJoystickFunc (NOT FINALIZED!). }
 
 const
+  GLUT_API_VERSION		= 4;
+
   // Display mode bit masks
   GLUT_RGB                      = 0;
   GLUT_RGBA                     = GLUT_RGB;
@@ -73,7 +81,29 @@ const
   GLUT_DOWN                     = 0;
   GLUT_UP                       = 1;
 
-  // Keys ###
+  // function keys
+  GLUT_KEY_F1			= 1;
+  GLUT_KEY_F2			= 2;
+  GLUT_KEY_F3			= 3;
+  GLUT_KEY_F4			= 4;
+  GLUT_KEY_F5			= 5;
+  GLUT_KEY_F6			= 6;
+  GLUT_KEY_F7			= 7;
+  GLUT_KEY_F8			= 8;
+  GLUT_KEY_F9			= 9;
+  GLUT_KEY_F10			= 10;
+  GLUT_KEY_F11			= 11;
+  GLUT_KEY_F12			= 12;
+  // directional keys
+  GLUT_KEY_LEFT			= 100;
+  GLUT_KEY_UP			= 101;
+  GLUT_KEY_RIGHT		= 102;
+  GLUT_KEY_DOWN			= 103;
+  GLUT_KEY_PAGE_UP		= 104;
+  GLUT_KEY_PAGE_DOWN		= 105;
+  GLUT_KEY_HOME			= 106;
+  GLUT_KEY_END			= 107;
+  GLUT_KEY_INSERT		= 108;
 
   // Enter / exit state
   GLUT_LEFT                     = 0;
@@ -102,9 +132,6 @@ const
   GLUT_NORMAL                   = 0;
   GLUT_OVERLAY                  = 1;
 
-  // Bitmap stuff###
-
-
   // glutGet parameters
   GLUT_WINDOW_X                 = 100;
   GLUT_WINDOW_Y                 = 101;
@@ -187,18 +214,85 @@ const
   GLUT_ACTIVE_CTRL              = 2;
   GLUT_ACTIVE_ALT               = 4;
 
-  // Cursor stuff ###
+  // glutSetCursor parameters
+  // Basic arrows
+  GLUT_CURSOR_RIGHT_ARROW	= 0;
+  GLUT_CURSOR_LEFT_ARROW	= 1;
+  // Symbolic cursor shapes
+  GLUT_CURSOR_INFO		= 2;
+  GLUT_CURSOR_DESTROY		= 3;
+  GLUT_CURSOR_HELP		= 4;
+  GLUT_CURSOR_CYCLE		= 5;
+  GLUT_CURSOR_SPRAY		= 6;
+  GLUT_CURSOR_WAIT		= 7;
+  GLUT_CURSOR_TEXT		= 8;
+  GLUT_CURSOR_CROSSHAIR		= 9;
+  // Directional cursors
+  GLUT_CURSOR_UP_DOWN		= 10;
+  GLUT_CURSOR_LEFT_RIGHT	= 11;
+  // Sizing cursors
+  GLUT_CURSOR_TOP_SIDE		= 12;
+  GLUT_CURSOR_BOTTOM_SIDE	= 13;
+  GLUT_CURSOR_LEFT_SIDE		= 14;
+  GLUT_CURSOR_RIGHT_SIDE	= 15;
+  GLUT_CURSOR_TOP_LEFT_CORNER	= 16;
+  GLUT_CURSOR_TOP_RIGHT_CORNER	= 17;
+  GLUT_CURSOR_BOTTOM_RIGHT_CORNER = 18;
+  GLUT_CURSOR_BOTTOM_LEFT_CORNER = 19;
+  // Inherit from parent window
+  GLUT_CURSOR_INHERIT		= 100;
+  // Blank cursor
+  GLUT_CURSOR_NONE		= 101;
+  // Fullscreen crosshair (if available)
+  GLUT_CURSOR_FULL_CROSSHAIR	= 102;
 
-// GLUT window callback sub-API
 type
+
+  // GLUT menu sub-API
+  TGlutCreateMenuFunc = procedure(arg: Int); cdecl;
+
+  // GLUT window callback sub-API
   TGlutDisplayFunc = procedure; cdecl;
-  TGlutReshapeFunc = procedure(width, height: Integer); cdecl;
+  TGlutReshapeFunc = procedure(width, height: Int); cdecl;
+  TGlutKeyboardFunc = procedure(key: Char; x, y: Int); cdecl;
+  TGlutMouseFunc = procedure(button, state, x, y: Int); cdecl;
+  TGlutMotionFunc = procedure(x, y: Int); cdecl;
+  TGlutPassiveMotionFunc = procedure(x, y: Int); cdecl;
+  TGlutEntryFunc = procedure(x, y: Int); cdecl;
+  TGlutVisibilityFunc = procedure(state: Int); cdecl;
+  TGlutIdleFunc = procedure; cdecl;
+  TGlutTimerFunc = procedure(value: Int); cdecl;
+  TGlutMenuStateFunc = procedure(state: Int); cdecl;
+  TGlutSpecialFunc = procedure(key, x, y: Int); cdecl;
+  TGlutSpaceballMotionFunc = procedure(x, y, z: Int); cdecl;
+  TGlutSpaceballRotateFunc = procedure(x, y, z: Int); cdecl;
+  TGlutSpaceballButtonFunc = procedure(button, state: Int); cdecl;
+  TGlutButtonBoxFunc = procedure(button, state: Int); cdecl;
+  TGlutDialsFunc = procedure(dial, value: Int); cdecl;
+  TGlutTabletMotionFunc = procedure(x, y: Int); cdecl;
+  TGlutTabletButtonFunc = procedure(button, state, x, y: Int); cdecl;
+  TGlutMenuStatusFunc = procedure(status, x, y: Int); cdecl;
+  TGlutOverlayDisplayFunc = procedure; cdecl;
+  TGlutWindowStatusFunc = procedure(state: Int); cdecl;
+  TGlutKeyboardUpFunc = procedure(key: Char; x, y: Int); cdecl;
+  TGlutSpecialUpFunc = procedure(key, x, y: Int); cdecl;
+  TGlutJoystickFunc = procedure(buttonMask: UnsignedInt; x, y, z: Int); cdecl;
 
-  TGlutTimerFunc = procedure(value: Integer); cdecl;
+const
+// GLUT device control sub-API
+  // glutSetKeyRepeat modes.
+  GLUT_KEY_REPEAT_OFF		= 0;
+  GLUT_KEY_REPEAT_ON		= 1;
+  GLUT_KEY_REPEAT_DEFAULT	= 2;
+
+  // Joystick button masks
+  GLUT_JOYSTICK_BUTTON_A	= 1;
+  GLUT_JOYSTICK_BUTTON_B	= 2;
+  GLUT_JOYSTICK_BUTTON_C	= 4;
+  GLUT_JOYSTICK_BUTTON_D	= 8;
 
 // GLUT game mode sub-API
-// glutGameModeGet
-const
+  // glutGameModeGet
   GLUT_GAME_MODE_ACTIVE         = 0;
   GLUT_GAME_MODE_POSSIBLE       = 1;
   GLUT_GAME_MODE_WIDTH          = 2;
@@ -209,112 +303,184 @@ const
 
 
 var
+
+{ The following stuff does not exist in the Win32 version: }
+(* commented out because cvars don't work in Delphi mode...
+// Stroke font opaque addresses (use constants instead in source code).
+var
+  glutStrokeRoman, glutStrokeMonoRoman: Pointer; cvar; external;
+
+// Stroke font constants (use these in GLUT program).
+const
+  GLUT_STROKE_ROMAN = @glutStrokeRoman;
+  GLUT_STROKE_MONO_ROMAN = @glutStrokeMonoRoman;
+
+// Bitmap font opaque addresses (use constants instead in source code).
+var
+  glutBitmap9By15, glutBitmap8By13, glutBitmapTimesRoman10,
+    glutBitmapTimesRoman24, glutBitmapHelvetica10, glutBitmapHelvetica12,
+    glutBitmapHelvetica18: Pointer; cdecl; external;
+
+// Bitmap font constants (use these in GLUT program).
+const
+  GLUT_BITMAP_9_BY_15 = @glutBitmap9By15;
+  GLUT_BITMAP_8_BY_13 = @glutBitmap8By13;
+  GLUT_BITMAP_TIMES_ROMAN_10 = @glutBitmapTimesRoman10;
+  GLUT_BITMAP_TIMES_ROMAN_24 = @glutBitmapTimesRoman24;
+  GLUT_BITMAP_HELVETICA_10 = @glutBitmapHelvetica10;
+  GLUT_BITMAP_HELVETICA_12 = @glutBitmapHelvetica12;
+  GLUT_BITMAP_HELVETICA_18 = @glutBitmapHelvetica18;*)
+
 // GLUT initialization sub-API
-  glutInit: procedure(var argcp: Integer; var argv: PChar); cdecl;
-  glutInitDisplayMode: procedure(mode: LongWord); cdecl;
-  glutInitDisplayString: procedure(AString: PChar); cdecl;
-  glutInitWindowPosition: procedure(x, y: Integer); cdecl;
-  glutInitWindowSize: procedure(width, height: Integer); cdecl;
+  glutInit: procedure(argcp: PInt; argv: PPChar); cdecl;
+  glutInitDisplayMode: procedure(mode: UnsignedInt); cdecl;
+  glutInitDisplayString: procedure(const AString: PChar); cdecl;
+  glutInitWindowPosition: procedure(x, y: Int); cdecl;
+  glutInitWindowSize: procedure(width, height: Int); cdecl;
   glutMainLoop: procedure; cdecl;
 
 // GLUT window sub-API
-  glutCreateWindow: function(title: PChar): Integer; cdecl;
-  glutCreateSubWindow: function(win, x, y, width, height: Integer): Integer; cdecl;
-  glutDestroyWindow: procedure(win: Integer); cdecl;
+  glutCreateWindow: function(const title: PChar): Int; cdecl;
+  glutCreateSubWindow: function(win, x, y, width, height: Int): Int; cdecl;
+  glutDestroyWindow: procedure(win: Int); cdecl;
   glutPostRedisplay: procedure; cdecl;
-  glutPostWindowRedisplay: procedure(win: Integer); cdecl;
+  glutPostWindowRedisplay: procedure(win: Int); cdecl;
   glutSwapBuffers: procedure; cdecl;
-  glutGetWindow: function: Integer; cdecl;
-  glutSetWindow: procedure(win: Integer); cdecl;
-  glutSetWindowTitle: procedure(title: PChar); cdecl;
+  glutGetWindow: function: Int; cdecl;
+  glutSetWindow: procedure(win: Int); cdecl;
+  glutSetWindowTitle: procedure(const title: PChar); cdecl;
   glutSetIconTitle: procedure(title: PChar); cdecl;
-  glutPositionWindow: procedure(x, y: Integer); cdecl;
-  glutReshapeWindow: procedure(width, height: Integer); cdecl;
+  glutPositionWindow: procedure(x, y: Int); cdecl;
+  glutReshapeWindow: procedure(width, height: Int); cdecl;
   glutPopWindow: procedure; cdecl;
   glutPushWindow: procedure; cdecl;
   glutIconifyWindow: procedure; cdecl;
   glutShowWindow: procedure; cdecl;
   glutHideWindow: procedure; cdecl;
   glutFullScreen: procedure; cdecl;
-  glutSetCursor: procedure(cursor: Integer); cdecl;
-  glutWarpPointer: procedure(x, y: Integer); cdecl;
-
-//overlays ###
-
-//menus ###
+  glutSetCursor: procedure(cursor: Int); cdecl;
+  glutWarpPointer: procedure(x, y: Int); cdecl;
+
+// GLUT overlay sub-API
+  glutEstablishOverlay: procedure; cdecl;
+  glutRemoveOverlay: procedure; cdecl;
+  glutUseLayer: procedure(layer: GLenum); cdecl;
+  glutPostOverlayRedisplay: procedure; cdecl;
+  glutPostWindowOverlayRedisplay: procedure(win: Int); cdecl;
+  glutShowOverlay: procedure; cdecl;
+  glutHideOverlay: procedure; cdecl;
+
+// GLUT menu sub-API
+  glutCreateMenu: function(func: TGlutCreateMenuFunc): Int; cdecl;
+  glutDestroyMenu: procedure(menu: Int); cdecl;
+  glutGetMenu: function: Int; cdecl;
+  glutSetMenu: procedure(menu: Int); cdecl;
+  glutAddMenuEntry: procedure(const ALabel: PChar; value: Int); cdecl;
+  glutAddSubMenu: procedure(const ALabel: PChar; submenu: Int); cdecl;
+  glutChangeToMenuEntry: procedure(item: Int; const ALabel: PChar; value: Int); cdecl;
+  glutChangeToSubMenu: procedure(item: Int; const ALabel: PChar; submenu: Int); cdecl;
+  glutRemoveMenuItem: procedure(item: Int); cdecl;
+  glutAttachMenu: procedure(button: Int); cdecl;
+  glutDetachMenu: procedure(button: Int); cdecl;
 
 // GLUT window callback sub-API
   glutDisplayFunc: procedure(func: TGlutDisplayFunc); cdecl;
   glutReshapeFunc: procedure(func: TGlutReshapeFunc); cdecl;
-
-  glutTimerFunc: procedure(millis: LongWord; func: TGlutTimerFunc; value: Integer); cdecl;
-
-
-// GLUTAPI void APIENTRY glutDisplayFunc(void (GLUTCALLBACK * func)(void));
-// GLUTAPI void APIENTRY glutReshapeFunc(void (GLUTCALLBACK * func)(int width, int height));
-// GLUTAPI void APIENTRY glutKeyboardFunc(void (GLUTCALLBACK * func)(unsigned char key, int x, int y));
-// GLUTAPI void APIENTRY glutMouseFunc(void (GLUTCALLBACK * func)(int button, int state, int x, int y));
-// GLUTAPI void APIENTRY glutMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
-// GLUTAPI void APIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
-// GLUTAPI void APIENTRY glutEntryFunc(void (GLUTCALLBACK * func)(int state));
-// GLUTAPI void APIENTRY glutVisibilityFunc(void (GLUTCALLBACK * func)(int state));
-// GLUTAPI void APIENTRY glutIdleFunc(void (GLUTCALLBACK * func)(void));
-// GLUTAPI void APIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK * func)(int value), int value);
-// GLUTAPI void APIENTRY glutMenuStateFunc(void (GLUTCALLBACK * func)(int state));
-// GLUTAPI void APIENTRY glutSpecialFunc(void (GLUTCALLBACK * func)(int key, int x, int y));
-// GLUTAPI void APIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK * func)(int x, int y, int z));
-// GLUTAPI void APIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK * func)(int x, int y, int z));
-// GLUTAPI void APIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK * func)(int button, int state));
-// GLUTAPI void APIENTRY glutButtonBoxFunc(void (GLUTCALLBACK * func)(int button, int state));
-// GLUTAPI void APIENTRY glutDialsFunc(void (GLUTCALLBACK * func)(int dial, int value));
-// GLUTAPI void APIENTRY glutTabletMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
-// GLUTAPI void APIENTRY glutTabletButtonFunc(void (GLUTCALLBACK * func)(int button, int state, int x, int y));
-// GLUTAPI void APIENTRY glutMenuStatusFunc(void (GLUTCALLBACK * func)(int status, int x, int y));
-// GLUTAPI void APIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK * func)(void));
-// GLUTAPI void APIENTRY glutWindowStatusFunc(void (GLUTCALLBACK * func)(int state));
-// GLUTAPI void APIENTRY glutKeyboardUpFunc(void (GLUTCALLBACK * func)(unsigned char key, int x, int y));
-// GLUTAPI void APIENTRY glutSpecialUpFunc(void (GLUTCALLBACK * func)(int key, int x, int y));
-// GLUTAPI void APIENTRY glutJoystickFunc(void (GLUTCALLBACK * func)(unsigned int buttonMask, int x, int y, int z), int pollInterval)
+  glutKeyboardFunc: procedure(func: TGlutKeyboardFunc); cdecl;
+  glutMouseFunc: procedure(func: TGlutMouseFunc); cdecl;
+  glutMotionFunc: procedure(func: TGlutMotionFunc); cdecl;
+  glutPassiveMotionFunc: procedure(func: TGlutPassiveMotionFunc); cdecl;
+  glutEntryFunc: procedure(func: TGlutEntryFunc); cdecl;
+  glutIdleFunc: procedure(func: TGlutIdleFunc); cdecl;
+  glutTimerFunc: procedure(millis: UnsignedInt; func: TGlutTimerFunc; value: Int); cdecl;
+  glutMenuStateFunc: procedure(func: TGlutMenuStateFunc); cdecl;
+  glutSpecialFunc: procedure(func: TGlutSpecialFunc); cdecl;
+  glutSpaceballMotionFunc: procedure(func: TGlutSpaceballMotionFunc); cdecl;
+  glutSpaceballRotateFunc: procedure(func: TGlutSpaceballRotateFunc); cdecl;
+  glutSpaceballButtonFunc: procedure(func: TGlutSpaceballButtonFunc); cdecl;
+  glutButtonBoxFunc: procedure(func: TGlutButtonBoxFunc); cdecl;
+  glutDialsFunc: procedure(func: TGlutDialsFunc); cdecl;
+  glutTabletMotionFunc: procedure(func: TGlutTabletMotionFunc); cdecl;
+  glutTabletButtonFunc: procedure(func: TGlutTabletButtonFunc); cdecl;
+  glutMenuStatusFunc: procedure(func: TGlutMenuStatusFunc); cdecl;
+  glutOverlayDisplayFunc: procedure(func: TGlutOverlayDisplayFunc); cdecl;
+  glutWindowStatusFunc: procedure(func: TGlutWindowStatusFunc); cdecl;
+  glutKeyboardUpFunc: procedure(func: TGlutKeyboardUpFunc); cdecl;
+  glutSpecialUpFunc: procedure(func: TGlutSpecialUpFunc); cdecl;
+  glutJoystickFunc: procedure(func: TGlutJoystickFunc; pollinterval: Int); cdecl;
 
 // GLUT color index sub-API
-  glutSetColor: procedure(index: Integer; red, green, blue: Single); cdecl;
-  glutGetColor: function(ndx, component: Integer): Single; cdecl;
-  glutCopyColormap: procedure(win: Integer); cdecl;
+  glutSetColor: procedure(index: Int; red, green, blue: GLfloat); cdecl;
+  glutGetColor: function(ndx, component: Int): GLfloat; cdecl;
+  glutCopyColormap: procedure(win: Int); cdecl;
 
 // GLUT state retrieval sub-API
-  glutGet: function(AType: GLEnum): Integer; cdecl;
-  glutDeviceGet: function(AType: GLEnum): Integer; cdecl;
-  glutExtensionSupported: function(name: PChar): Integer; cdecl;
-  glutGetModifiers: function: Integer; cdecl;
-  glutLayerGet: function(AType: GLEnum): Integer; cdecl;
-
-// fonts ###
-
-// pre-built models ###
-
-// video resize ###
-
-// debugging ###
-
-// device control ###
-
+  glutGet: function(AType: GLEnum): Int; cdecl;
+  glutDeviceGet: function(AType: GLEnum): Int; cdecl;
+  glutExtensionSupported: function(const name: PChar): Int; cdecl;
+  glutGetModifiers: function: Int; cdecl;
+  glutLayerGet: function(AType: GLEnum): Int; cdecl;
+
+// GLUT font sub-API
+  glutBitmapCharacter: procedure(font: Pointer; character: Int); cdecl;
+  glutBitmapWidth: function(font: Pointer; character: Int): Int; cdecl;
+  glutStrokeCharacter: procedure(font: Pointer; character: Int); cdecl;
+  glutStrokeWidth: function(font: Pointer; character: Int): Int; cdecl;
+  glutBitmapLength: function(font: Pointer; const AString: PChar): Int; cdecl;
+  glutStrokeLength: function(font: Pointer; const AString: PChar): Int; cdecl;
+
+// GLUT pre-built models sub-API
+  glutWireSphere: procedure(radius: GLdouble; slices, stacks: GLint); cdecl;
+  glutSolidSphere: procedure(radius: GLdouble; slices, stacks: GLint); cdecl;
+  glutWireCone: procedure(base: GLdouble; height: GLdouble; slices, stacks: GLint); cdecl;
+  glutSolidCone: procedure(base: GLdouble; height: GLdouble; slices, stacks: GLint); cdecl;
+  glutWireCube: procedure(size: GLdouble); cdecl;
+  glutSolidCube: procedure(size: GLdouble); cdecl;
+  glutWireTorus: procedure(innerRadius, outerRadius: GLdouble; sides, rings: GLint); cdecl;
+  glutSolidTorus: procedure(innerRadius, outerRadius: GLdouble; sides, rings: GLint); cdecl;
+  glutWireDodecahedron: procedure; cdecl;
+  glutSolidDodecahedron: procedure; cdecl;
+  glutWireTeapot: procedure(size: GLdouble); cdecl;
+  glutSolidTeapot: procedure(size: GLdouble); cdecl;
+  glutWireOctahedron: procedure; cdecl;
+  glutSolidOctahedron: procedure; cdecl;
+  glutWireTetrahedron: procedure; cdecl;
+  glutSolidTetrahedron: procedure; cdecl;
+  glutWireIcosahedron: procedure; cdecl;
+  glutSolidIcosahedron: procedure; cdecl;
+
+// GLUT video resize sub-API
+  glutVideoResizeGet: function(param: GLenum): Int; cdecl;
+  glutSetupVideoResizing: procedure; cdecl;
+  glutStopVideoResizing: procedure; cdecl;
+  glutVideoResize: procedure(x, y, width, height: Int); cdecl;
+  glutVideoPan: procedure(x, y, width, height: Int); cdecl;
+
+// GLUT debugging sub-API
+  glutReportErrors: procedure; cdecl;
+
+// GLUT device control sub-API
+  glutIgnoreKeyRepeat: procedure(ignore: Int); cdecl;
+  glutSetKeyRepeat: procedure(repeatMode: Int); cdecl;
+  glutForceJoystickFunc: procedure; cdecl;
 
 // GLUT game mode sub-API
-  glutGameModeString: procedure(AString: PChar); cdecl;
+  glutGameModeString: procedure(const AString: PChar); cdecl;
   glutEnterGameMode: function: Integer; cdecl;
   glutLeaveGameMode: procedure; cdecl;
-  glutGameModeGet: function(mode: GLEnum): Integer; cdecl;
+  glutGameModeGet: function(mode: GLEnum): Int; cdecl;
+
 
 
 implementation
 
 {$LINKLIB Xmu}
 
-function dlopen(AFile: PChar; mode: LongInt): Pointer; external 'dl';
+function dlopen(const AFile: PChar; mode: LongInt): Pointer; external 'dl';
 function dlclose(handle: Pointer): LongInt; external 'dl';
-function dlsym(handle: Pointer; name: PChar): Pointer; external 'dl';
+function dlsym(handle: Pointer; const name: PChar): Pointer; external 'dl';
 
-function LoadLibrary(name: PChar): Pointer;
+function LoadLibrary(const name: PChar): Pointer;
 begin
   Result := dlopen(name, $101 {RTLD_GLOBAL or RTLD_LAZY});
 end;
@@ -324,7 +490,7 @@ begin
   dlclose(handle);
 end;
 
-function GetProc(handle: Pointer; name: PChar): Pointer;
+function GetProc(handle: Pointer; const name: PChar): Pointer;
 begin
   Result := dlsym(handle, name);
   if not Assigned(Result) and GLUTDumpUnresolvedFunctions then
@@ -334,11 +500,12 @@ end;
 var
   libGLUT: Pointer;
 
-function InitGLUTFromLibrary(libname: PChar): Boolean;
+function InitGLUTFromLibrary(const libname: PChar): Boolean;
 begin
   Result := False;
   libGLUT := LoadLibrary(libname);
-  if not Assigned(libGLUT) then exit;
+  if not Assigned(libGLUT) then
+    exit;
 
   glutInit := GetProc(libglut, 'glutInit');
   glutInitDisplayMode := GetProc(libglut, 'glutInitDisplayMode');
@@ -366,9 +533,48 @@ begin
   glutFullScreen := GetProc(libglut, 'glutFullScreen');
   glutSetCursor := GetProc(libglut, 'glutSetCursor');
   glutWarpPointer := GetProc(libglut, 'glutWarpPointer');
+  glutEstablishOverlay := GetProc(libglut, 'glutEstablishOverlay');
+  glutRemoveOverlay := GetProc(libglut, 'glutRemoveOverlay');
+  glutUseLayer := GetProc(libglut, 'glutUseLayer');
+  glutPostOverlayRedisplay := GetProc(libglut, 'glutPostOverlayRedisplay');
+  glutPostWindowOverlayRedisplay := GetProc(libglut, 'glutPostWindowOverlayRedisplay');
+  glutShowOverlay := GetProc(libglut, 'glutShowOverlay');
+  glutHideOverlay := GetProc(libglut, 'glutHideOverlay');
+  glutCreateMenu := GetProc(libglut, 'glutCreateMenu');
+  glutDestroyMenu := GetProc(libglut, 'glutDestroyMenu');
+  glutGetMenu := GetProc(libglut, 'glutGetMenu');
+  glutSetMenu := GetProc(libglut, 'glutSetMenu');
+  glutAddMenuEntry := GetProc(libglut, 'glutAddMenuEntry');
+  glutAddSubMenu := GetProc(libglut, 'glutAddSubMenu');
+  glutChangeToMenuEntry := GetProc(libglut, 'glutChangeToMenuEntry');
+  glutChangeToSubMenu := GetProc(libglut, 'glutChangeToSubMenu');
+  glutRemoveMenuItem := GetProc(libglut, 'glutRemoveMenuItem');
+  glutAttachMenu := GetProc(libglut, 'glutAttachMenu');
+  glutDetachMenu := GetProc(libglut, 'glutDetachMenu');
   glutDisplayFunc := GetProc(libglut, 'glutDisplayFunc');
   glutReshapeFunc := GetProc(libglut, 'glutReshapeFunc');
+  glutKeyboardFunc := GetProc(libglut, 'glutKeyboardFunc');
+  glutMouseFunc := GetProc(libglut, 'glutMouseFunc');
+  glutMotionFunc := GetProc(libglut, 'glutMotionFunc');
+  glutPassiveMotionFunc := GetProc(libglut, 'glutPassiveMotionFunc');
+  glutEntryFunc := GetProc(libglut, 'glutEntryFunc');
+  glutIdleFunc := GetProc(libglut, 'glutIdleFunc');
   glutTimerFunc := GetProc(libglut, 'glutTimerFunc');
+  glutMenuStateFunc := GetProc(libglut, 'glutMenuStateFunc');
+  glutSpecialFunc := GetProc(libglut, 'glutSpecialFunc');
+  glutSpaceballMotionFunc := GetProc(libglut, 'glutSpaceballMotionFunc');
+  glutSpaceballRotateFunc := GetProc(libglut, 'glutSpaceballRotateFunc');
+  glutSpaceballButtonFunc := GetProc(libglut, 'glutSpaceballButtonFunc');
+  glutButtonBoxFunc := GetProc(libglut, 'glutButtonBoxFunc');
+  glutDialsFunc := GetProc(libglut, 'glutDialsFunc');
+  glutTabletMotionFunc := GetProc(libglut, 'glutTabletMotionFunc');
+  glutTabletButtonFunc := GetProc(libglut, 'glutTabletButtonFunc');
+  glutMenuStatusFunc := GetProc(libglut, 'glutMenuStatusFunc');
+  glutOverlayDisplayFunc := GetProc(libglut, 'glutOverlayDisplayFunc');
+  glutWindowStatusFunc := GetProc(libglut, 'glutWindowStatusFunc');
+  glutKeyboardUpFunc := GetProc(libglut, 'glutKeyboardUpFunc');
+  glutSpecialUpFunc := GetProc(libglut, 'glutSpecialUpFunc');
+  glutJoystickFunc := GetProc(libglut, 'glutJoystickFunc');
   glutSetColor := GetProc(libglut, 'glutSetColor');
   glutGetColor := GetProc(libglut, 'glutGetColor');
   glutCopyColormap := GetProc(libglut, 'glutCopyColormap');
@@ -377,6 +583,39 @@ begin
   glutExtensionSupported := GetProc(libglut, 'glutExtensionSupported');
   glutGetModifiers := GetProc(libglut, 'glutGetModifiers');
   glutLayerGet := GetProc(libglut, 'glutLayerGet');
+  glutBitmapCharacter := GetProc(libglut, 'glutBitmapCharacter');
+  glutBitmapWidth := GetProc(libglut, 'glutBitmapWidth');
+  glutStrokeCharacter := GetProc(libglut, 'glutStrokeCharacter');
+  glutStrokeWidth := GetProc(libglut, 'glutStrokeWidth');
+  glutBitmapLength := GetProc(libglut, 'glutBitmapLength');
+  glutStrokeLength := GetProc(libglut, 'glutStrokeLength');
+  glutWireSphere := GetProc(libglut, 'glutWireSphere');
+  glutSolidSphere := GetProc(libglut, 'glutSolidSphere');
+  glutWireCone := GetProc(libglut, 'glutWireCone');
+  glutSolidCone := GetProc(libglut, 'glutSolidCone');
+  glutWireCube := GetProc(libglut, 'glutWireCube');
+  glutSolidCube := GetProc(libglut, 'glutSolidCube');
+  glutWireTorus := GetProc(libglut, 'glutWireTorus');
+  glutSolidTorus := GetProc(libglut, 'glutSolidTorus');
+  glutWireDodecahedron := GetProc(libglut, 'glutWireDodecahedron');
+  glutSolidDodecahedron := GetProc(libglut, 'glutSolidDodecahedron');
+  glutWireTeapot := GetProc(libglut, 'glutWireTeapot');
+  glutSolidTeapot := GetProc(libglut, 'glutSolidTeapot');
+  glutWireOctahedron := GetProc(libglut, 'glutWireOctahedron');
+  glutSolidOctahedron := GetProc(libglut, 'glutSolidOctahedron');
+  glutWireTetrahedron := GetProc(libglut, 'glutWireTetrahedron');
+  glutSolidTetrahedron := GetProc(libglut, 'glutSolidTetrahedron');
+  glutWireIcosahedron := GetProc(libglut, 'glutWireIcosahedron');
+  glutSolidIcosahedron := GetProc(libglut, 'glutSolidIcosahedron');
+  glutVideoResizeGet := GetProc(libglut, 'glutVideoResizeGet');
+  glutSetupVideoResizing := GetProc(libglut, 'glutSetupVideoResizing');
+  glutStopVideoResizing := GetProc(libglut, 'glutStopVideoResizing');
+  glutVideoResize := GetProc(libglut, 'glutVideoResize');
+  glutVideoPan := GetProc(libglut, 'glutVideoPan');
+  glutReportErrors := GetProc(libglut, 'glutReportErrors');
+  glutIgnoreKeyRepeat := GetProc(libglut, 'glutIgnoreKeyRepeat');
+  glutSetKeyRepeat := GetProc(libglut, 'glutSetKeyRepeat');
+  glutForceJoystickFunc := GetProc(libglut, 'glutForceJoystickFunc');
   glutGameModeString := GetProc(libglut, 'glutGameModeString');
   glutEnterGameMode := GetProc(libglut, 'glutEnterGameMode');
   glutLeaveGameMode := GetProc(libglut, 'glutLeaveGameMode');
@@ -402,7 +641,9 @@ end.
 
 {
   $Log$
-  Revision 1.4  2000-03-16 17:40:39  sg
-  * Fixed GL* library loading functions
+  Revision 1.5  2000-05-25 18:59:50  sg
+  * Completed GLU and GLUT support
+  * Some minor fixes (missing "const"s, changed some untyped "var" arguments
+    to "const" arguments etc.)
 
 }

Some files were not shown because too many files changed in this diff