mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-07-21 18:36:14 +02:00
143 lines
3.3 KiB
Plaintext
143 lines
3.3 KiB
Plaintext
{
|
|
$Id$
|
|
|
|
Translation of the Mesa GLU headers for FreePascal
|
|
Copyright (C) 1999 Sebastian Guenther
|
|
|
|
|
|
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.
|
|
}
|
|
|
|
{$MODE delphi} // objfpc would not work because of direct proc var assignments
|
|
|
|
{You have to enable Macros (compiler switch "-Sm") for compiling this unit!
|
|
This is necessary for supporting different platforms with different calling
|
|
conventions via a single unit.}
|
|
|
|
unit GLU;
|
|
|
|
interface
|
|
|
|
{$MACRO ON}
|
|
|
|
{$IFDEF Linux}
|
|
uses GL;
|
|
{$ELSE}
|
|
{$MESSAGE Unsupported platform.}
|
|
{$ENDIF}
|
|
|
|
|
|
// =======================================================
|
|
// Unit specific extensions
|
|
// =======================================================
|
|
|
|
function InitGLUFromLibrary(libname: PChar): Boolean;
|
|
|
|
|
|
// determines automatically which libraries to use:
|
|
function InitGLU: Boolean;
|
|
|
|
|
|
var
|
|
GLUDumpUnresolvedFunctions,
|
|
GLUInitialized: Boolean;
|
|
|
|
|
|
// =======================================================
|
|
// GLU consts, types and functions
|
|
// =======================================================
|
|
|
|
%GLUDeclsIF
|
|
|
|
var
|
|
%GLUProcsPD
|
|
|
|
|
|
// =======================================================
|
|
//
|
|
// =======================================================
|
|
|
|
implementation
|
|
|
|
{$LINKLIB m}
|
|
|
|
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;
|
|
begin
|
|
Result := dlopen(name, $101 {RTLD_GLOBAL or RTLD_LAZY});
|
|
end;
|
|
|
|
function GetProc(handle: Pointer; name: PChar): Pointer;
|
|
begin
|
|
Result := dlsym(handle, name);
|
|
if (Result = nil) and GLUDumpUnresolvedFunctions then
|
|
WriteLn('Unresolved: ', name);
|
|
end;
|
|
|
|
var
|
|
libGLU : Pointer;
|
|
|
|
function InitGLUFromLibrary(libname: PChar): Boolean;
|
|
begin
|
|
Result := False;
|
|
libGLU := LoadLibrary(libname);
|
|
if not Assigned(libGLU) then exit;
|
|
|
|
%GLUProcsPL
|
|
|
|
GLUInitialized := True;
|
|
Result := True;
|
|
end;
|
|
|
|
|
|
function InitGLU: Boolean;
|
|
begin
|
|
Result := InitGLUFromLibrary('libGLU.so') or
|
|
InitGLUFromLibrary('libGLU.so.1') or
|
|
InitGLUFromLibrary('libMesaGLU.so') or
|
|
InitGLUFromLibrary('libMesaGLU.so.3');
|
|
end;
|
|
|
|
|
|
initialization
|
|
InitGlU;
|
|
finalization
|
|
if Assigned(libGLU) then dlclose(libGLU);
|
|
end.
|
|
|
|
|
|
{
|
|
$Log$
|
|
Revision 1.1 2000-09-03 21:25:45 peter
|
|
* new updated version
|
|
* gtkglarea unit and demo
|
|
* win32 opengl headers
|
|
* morph3d demo
|
|
|
|
Revision 1.1 2000/07/13 06:34:18 michael
|
|
+ Initial import
|
|
|
|
Revision 1.1 2000/05/31 00:35:14 alex
|
|
added working templates
|
|
|
|
}
|