glut_w32d.tem 1021 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. {$MODE delphi}
  2. unit GLUT;
  3. interface
  4. {$IFDEF Win32}
  5. {$DEFINE glut_dll := }
  6. {$DEFINE gldecl := stdcall;}
  7. {$DEFINE extdecl := stdcall;}
  8. uses windows, GL;
  9. {$ELSE}
  10. {$MESSAGE Unsupported platform.}
  11. {$ENDIF}
  12. function InitGLUTFromLibrary(libname: PChar): Boolean;
  13. // determines automatically which library to use:
  14. function InitGLUT: Boolean;
  15. var
  16. GLUTInitialized: Boolean;
  17. %GLUTDeclsIF
  18. var
  19. %GLUTProcsPD
  20. implementation
  21. type
  22. HInstance = LongWord;
  23. var
  24. libGLUT: HInstance;
  25. function GetProc(handle: HInstance; name: PChar): Pointer;
  26. begin
  27. Result := GetProcAddress(handle, name);
  28. if Result = nil then WriteLn('Unresolved: ', name);
  29. end;
  30. function InitGLUTFromLibrary(libname: PChar): Boolean;
  31. begin
  32. Result := False;
  33. libGLUT := LoadLibrary(libname);
  34. if libGLUT = 0 then exit;
  35. %GLUTProcsPL
  36. GLUTInitialized := True;
  37. Result := True;
  38. end;
  39. function InitGLUT: Boolean;
  40. begin
  41. Result := InitGLUTFromLibrary('glut32.dll');
  42. end;
  43. finalization
  44. if libGLUT <> 0 then FreeLibrary(libGLUT);
  45. end.