made templates work

This commit is contained in:
alex 2000-05-31 00:34:28 +00:00
parent 213941063d
commit cf21c94a6b
4 changed files with 144 additions and 1718 deletions

File diff suppressed because it is too large Load Diff

View File

@ -188,6 +188,11 @@ const
%GLProcsPS11
{$ENDIF GL1_1}
{$IFDEF GL1_2}
%GLProcsPS12
{$ENDIF GL1_2}
// -------------------------------------------------------
// GL Extensions
// -------------------------------------------------------
@ -207,15 +212,6 @@ const
{$endif MESA}
// -------------------------------------------------------
// GL 1.2 Functions
// -------------------------------------------------------
{$IFDEF GL1_2}
%GLProcsPS12
{$ENDIF GL1_2}
// =======================================================
// =======================================================

View File

@ -4,14 +4,13 @@ unit GLUT;
interface
uses GL;
{$IFDEF Linux}
{$DEFINE gldecl := cdecl}
{$IFDEF Win32}
{$DEFINE glut_dll := }
{$DEFINE gldecl := stdcall;}
{$DEFINE extdecl := stdcall;}
uses windows, GL;
{$ELSE}
{$IFDEF Win32}
{$DEFINE gldecl := stdcall}
{$ENDIF}
{$MESSAGE Unsupported platform.}
{$ENDIF}
@ -27,61 +26,25 @@ var
%GLUTDeclsIF
var
%GLUTProcsPD
implementation
{$IFDEF Linux}
{$LINKLIB Xmu}
type
HInstance = LongWord;
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): HInstance;
begin
Result := LongWord(dlopen(name, $101 {RTLD_GLOBAL or RTLD_LAZY}));
end;
procedure FreeLibrary(handle: HInstance);
begin
dlclose(Pointer(handle));
end;
function GetProcAddress(handle: HInstance; name: PChar): Pointer;
begin
Result := dlsym(Pointer(handle), name);
if Result = nil then WriteLn('Unresolved: ', name);
end;
{$ENDIF}
{$IFDEF Win32}
type
HInstance = LongWord;
function LoadLibrary(name: PChar): HInstance;
begin
Result := 0;
end;
procedure FreeLibrary(handle: HInstance);
begin
end;
function GetProcAddress(handle: HInstance; name: PChar): Pointer;
begin
Result := NIL;
if Result = nil then WriteLn('Unresolved: ', name);
end;
{$ENDIF}
var
libGLUT: HInstance;
function GetProc(handle: HInstance; name: PChar): Pointer;
begin
Result := GetProcAddress(handle, name);
if Result = nil then WriteLn('Unresolved: ', name);
end;
function InitGLUTFromLibrary(libname: PChar): Boolean;
begin
Result := False;
@ -97,15 +60,7 @@ end;
function InitGLUT: Boolean;
begin
{$IFDEF Win32}
Result := InitGLUTFromLibrary('glut32.dll');
{$ELSE}
{$IFDEF Linux}
Result := InitGLUTFromLibrary('libglut.so');
{$ELSE}
{$ERROR Unsupported platform}
{$ENDIF}
{$ENDIF}
end;

View File

@ -21,18 +21,19 @@
This is necessary for supporting different platforms with different calling
conventions via a single unit.}
unit GLUT_SL; { version which does statically linking }
unit GLUT; { version which does statically linking }
interface
uses GL_SL;
uses GL;
{x$DEFINE GLUT_GAME} {enable if you need game mode sub api}
{$IFDEF Win32}
{$DEFINE glut_dll := external 'glut32.dll'}
{$DEFINE glut_callback := cdecl}
{$DEFINE extdecl := }
{$ELSE}
{$MESSAGE Unsupported platform.}
{$ENDIF}