Browse Source

* Fixed GL* library loading functions

sg 25 years ago
parent
commit
d743f93616

+ 3 - 3
packages/opengl/build/README

@@ -1,5 +1,5 @@
 Free Pascal GL* Units
-(c) 1999 Sebastian Guenther
+(c) 1999-2000 Sebastian Guenther, [email protected]
 
 
 buildgl.pp
@@ -10,8 +10,8 @@ holds the informations in the read .def file.
 
 c_linuxd.pp
 -----------
-This program creates the dynamic Linux units "linuxd/gl.pp" and
-"linuxd/glut.pp".
+This program creates the Linux units "linux/gl.pp" and "linux/glut.pp".
+
 
 *.def
 -----

+ 12 - 4
packages/opengl/build/gl_linux.tpl

@@ -1,7 +1,7 @@
 {
   $Id$
   Translation of the Mesa GL, GLU and GLX headers for Free Pascal
-  Linux Version, Copyright (C) 1999 Sebastian Guenther
+  Linux Version, Copyright (C) 1999-2000 Sebastian Guenther
 
 
   Mesa 3-D graphics library
@@ -47,6 +47,11 @@ function InitGLU: Boolean;
 var
   GLInitialized, GLUInitialized, GLXInitialized: Boolean;
 
+  { Set the following value to True if you want to have a list of all
+    unresolved GL/GLU/GLX functions dumped to the console }
+  GLDumpUnresolvedFunctions: Boolean;
+
+
 %GLDecls
 
 %GLProcs1
@@ -84,7 +89,8 @@ end;
 function GetProc(handle: Pointer; name: PChar): Pointer;
 begin
   Result := dlsym(handle, name);
-  if Result = nil then WriteLn('Unresolved: ', name);
+  if not Assigned(Result) and GLDumpUnresolvedFunctions then
+    WriteLn('Unresolved: ', name);
 end;
 
 var
@@ -129,12 +135,14 @@ end;
 
 function InitGL: Boolean;
 begin
-  Result := InitGLFromLibrary('libGL.so.1') or InitGLFromLibrary('libMesaGL.so.1');
+  Result := InitGLFromLibrary('libGL.so') or InitGLFromLibrary('libGL.so.1') or
+    InitGLFromLibrary('libMesaGL.so.3');
 end;
 
 function InitGLU: Boolean;
 begin
-  Result := InitGLUFromLibrary('libGLU.so.1') or InitGLUFromLibrary('libMesaGLU.so.1');
+  Result := InitGLUFromLibrary('libGLU.so') or
+    InitGLUFromLibrary('libGLU.so.1') or InitGLUFromLibrary('libMesaGLU.so.3');
 end;
 
 

+ 10 - 4
packages/opengl/build/glut_linux.tpl

@@ -2,7 +2,7 @@
   $Id$
 
   Translation of the Mesa GLUT headers for FreePascal
-  Linux Version, Copyright (C) 1999 Sebastian Guenther
+  Linux Version, Copyright (C) 1999-2000 Sebastian Guenther
 
 
   Mesa 3-D graphics library
@@ -42,6 +42,10 @@ function InitGLUT: Boolean;
 var
   GLUTInitialized: Boolean;
 
+  { Set the following value to True if you want to have a list of all
+    unresolved GLUT functions dumped to the console }
+  GLUTDumpUnresolvedFunctions: Boolean;
+
 
 
 
@@ -229,7 +233,8 @@ end;
 function GetProc(handle: Pointer; name: PChar): Pointer;
 begin
   Result := dlsym(handle, name);
-//  if Result = nil then WriteLn('Unresolved: ', name);
+  if not Assigned(Result) and GLUTDumpUnresolvedFunctions then
+    WriteLn('Unresolved: ', name);
 end;
 
 var
@@ -250,11 +255,12 @@ end;
 
 function InitGLUT: Boolean;
 begin
-  Result := InitGLUTFromLibrary('libglut.so.1');
+  Result := InitGLUTFromLibrary('libglut.so') or InitGLUTFromLibrary('libglut.so.3');
 end;
 
 
 
 finalization
-  if Assigned(libGLUT) then FreeLibrary(libGLUT);
+  if Assigned(libGLUT) then
+    FreeLibrary(libGLUT);
 end.

+ 10 - 0
packages/opengl/examples/glutdemo.pp

@@ -101,6 +101,15 @@ end;
 
 begin
 
+  WriteLn('Dumping unresolved GL* function names; having unresolved functions ');
+  WriteLn('is NOT a problem as long as the application doesn''t use them!');
+  WriteLn('(Most unresolved functions will be propietary extensions which');
+  WriteLn(' should be an official GL extension)');
+  WriteLn;
+
+  GLDumpUnresolvedFunctions := True;
+  GLUTDumpUnresolvedFunctions := True;
+
   if not InitGl then begin
     WriteLn('OpenGL is not supported on this system');
     Halt(2);
@@ -127,6 +136,7 @@ begin
   glutTimerFunc(20, @OnTimer, 0);
 
 
+  WriteLn;
   WriteLn('GL info:');
   WriteLn('  Vendor: ', glGetString(GL_VENDOR));
   WriteLn('  Renderer: ', glGetString(GL_RENDERER));

+ 14 - 7
packages/opengl/linux/gl.pp

@@ -1,7 +1,7 @@
 {
   $Id$
   Translation of the Mesa GL, GLU and GLX headers for Free Pascal
-  Linux Version, Copyright (C) 1999 Sebastian Guenther
+  Linux Version, Copyright (C) 1999-2000 Sebastian Guenther
 
 
   Mesa 3-D graphics library
@@ -47,6 +47,11 @@ function InitGLU: Boolean;
 var
   GLInitialized, GLUInitialized, GLXInitialized: Boolean;
 
+  { Set the following value to True if you want to have a list of all
+    unresolved GL/GLU/GLX functions dumped to the console }
+  GLDumpUnresolvedFunctions: Boolean;
+
+
 // ===================================================================
 //   GL consts, types and functions
 // ===================================================================
@@ -1677,7 +1682,8 @@ end;
 function GetProc(handle: Pointer; name: PChar): Pointer;
 begin
   Result := dlsym(handle, name);
-  if Result = nil then WriteLn('Unresolved: ', name);
+  if not Assigned(Result) and GLDumpUnresolvedFunctions then
+    WriteLn('Unresolved: ', name);
 end;
 
 var
@@ -2122,12 +2128,14 @@ end;
 
 function InitGL: Boolean;
 begin
-  Result := InitGLFromLibrary('libGL.so.1') or InitGLFromLibrary('libMesaGL.so.1');
+  Result := InitGLFromLibrary('libGL.so') or InitGLFromLibrary('libGL.so.1') or
+    InitGLFromLibrary('libMesaGL.so.3');
 end;
 
 function InitGLU: Boolean;
 begin
-  Result := InitGLUFromLibrary('libGLU.so.1') or InitGLUFromLibrary('libMesaGLU.so.1');
+  Result := InitGLUFromLibrary('libGLU.so') or
+    InitGLUFromLibrary('libGLU.so.1') or InitGLUFromLibrary('libMesaGLU.so.3');
 end;
 
 
@@ -2141,8 +2149,7 @@ end.
 
 {
   $Log$
-  Revision 1.3  2000-01-26 21:21:49  peter
-    * link with .so.1 files, the .so files are for development only and
-      not available in runtime installs.
+  Revision 1.4  2000-03-16 17:40:39  sg
+  * Fixed GL* library loading functions
 
 }

+ 12 - 7
packages/opengl/linux/glut.pp

@@ -2,7 +2,7 @@
   $Id$
 
   Translation of the Mesa GLUT headers for FreePascal
-  Linux Version, Copyright (C) 1999 Sebastian Guenther
+  Linux Version, Copyright (C) 1999-2000 Sebastian Guenther
 
 
   Mesa 3-D graphics library
@@ -42,6 +42,10 @@ function InitGLUT: Boolean;
 var
   GLUTInitialized: Boolean;
 
+  { Set the following value to True if you want to have a list of all
+    unresolved GLUT functions dumped to the console }
+  GLUTDumpUnresolvedFunctions: Boolean;
+
 
 
 
@@ -323,7 +327,8 @@ end;
 function GetProc(handle: Pointer; name: PChar): Pointer;
 begin
   Result := dlsym(handle, name);
-//  if Result = nil then WriteLn('Unresolved: ', name);
+  if not Assigned(Result) and GLUTDumpUnresolvedFunctions then
+    WriteLn('Unresolved: ', name);
 end;
 
 var
@@ -384,20 +389,20 @@ end;
 
 function InitGLUT: Boolean;
 begin
-  Result := InitGLUTFromLibrary('libglut.so.1');
+  Result := InitGLUTFromLibrary('libglut.so') or InitGLUTFromLibrary('libglut.so.3');
 end;
 
 
 
 finalization
-  if Assigned(libGLUT) then FreeLibrary(libGLUT);
+  if Assigned(libGLUT) then
+    FreeLibrary(libGLUT);
 end.
 
 
 {
   $Log$
-  Revision 1.3  2000-01-26 21:21:50  peter
-    * link with .so.1 files, the .so files are for development only and
-      not available in runtime installs.
+  Revision 1.4  2000-03-16 17:40:39  sg
+  * Fixed GL* library loading functions
 
 }