* Fixed GL* library loading functions

This commit is contained in:
sg 2000-03-16 17:40:39 +00:00
parent f0ae56bc9c
commit d743f93616
6 changed files with 61 additions and 25 deletions

View File

@ -1,5 +1,5 @@
Free Pascal GL* Units
(c) 1999 Sebastian Guenther
(c) 1999-2000 Sebastian Guenther, sg@freepascal.org
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
-----

View File

@ -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;

View File

@ -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.

View File

@ -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));

View File

@ -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
}

View File

@ -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
}