123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- {$MODE delphi}
- unit GLUT;
- interface
- {$MACRO ON}
- {$IFDEF Win32}
- {$DEFINE glut_dll := }
- {$DEFINE gldecl := stdcall;}
- {$DEFINE extdecl := stdcall;}
- uses windows, GL;
- {$ELSE}
- {$MESSAGE Unsupported platform.}
- {$ENDIF}
- function InitGLUTFromLibrary(libname: PChar): Boolean;
- // determines automatically which library to use:
- function InitGLUT: Boolean;
- var
- GLUTDumpUnresolvedFunctions,
- GLUTInitialized: Boolean;
- %GLUTDeclsIF
- var
- %GLUTProcsPD
- implementation
- type
- HInstance = LongWord;
- var
- libGLUT: HInstance;
- function GetProc(handle: HInstance; name: PChar): Pointer;
- begin
- Result := GetProcAddress(handle, name);
- if (Result = nil) and GLUDumpUnresolvedFunctions then
- WriteLn('Unresolved: ', name);
- end;
- function InitGLUTFromLibrary(libname: PChar): Boolean;
- begin
- Result := False;
- libGLUT := LoadLibrary(libname);
- if libGLUT = 0 then exit;
- %GLUTProcsPL
- GLUTInitialized := True;
- Result := True;
- end;
- function InitGLUT: Boolean;
- begin
- Result := InitGLUTFromLibrary('glut32.dll');
- end;
- initialization
- InitGLUT;
- finalization
- if libGLUT <> 0 then FreeLibrary(libGLUT);
- end.
|