glu_w32d.tem 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. {
  2. $Id$
  3. Translation of the Mesa GLU headers for FreePascal
  4. Copyright (C) 1999 Sebastian Guenther
  5. Mesa 3-D graphics library
  6. Version: 3.0
  7. Copyright (C) 1995-1998 Brian Paul
  8. This library is free software; you can redistribute it and/or
  9. modify it under the terms of the GNU Library General Public
  10. License as published by the Free Software Foundation; either
  11. version 2 of the License, or (at your option) any later version.
  12. This library is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. Library General Public License for more details.
  16. You should have received a copy of the GNU Library General Public
  17. License along with this library; if not, write to the Free
  18. Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. }
  20. {$MODE delphi} // objfpc would not work because of direct proc var assignments
  21. {You have to enable Macros (compiler switch "-Sm") for compiling this unit!
  22. This is necessary for supporting different platforms with different calling
  23. conventions via a single unit.}
  24. unit GLU;
  25. interface
  26. {$MACRO ON}
  27. {$IFDEF Win32}
  28. {$DEFINE glu_dll := }
  29. uses Windows, GL;
  30. {$ELSE}
  31. {$MESSAGE Unsupported platform.}
  32. {$ENDIF}
  33. // =======================================================
  34. // Unit specific extensions
  35. // =======================================================
  36. function InitGLUFromLibrary(libname: PChar): Boolean;
  37. // determines automatically which libraries to use:
  38. function InitGLU: Boolean;
  39. var
  40. GLUDumpUnresolvedFunctions,
  41. GLUInitialized: Boolean;
  42. // =======================================================
  43. // GLU consts, types and functions
  44. // =======================================================
  45. %GLUDeclsIF
  46. var
  47. %GLUProcsPD
  48. // =======================================================
  49. //
  50. // =======================================================
  51. implementation
  52. type
  53. HInstance = LongWord;
  54. var
  55. libGLU : HInstance;
  56. function GetProc(handle: HInstance; name: PChar): Pointer;
  57. begin
  58. Result := GetProcAddress(handle, name);
  59. if (Result = nil) and GLUDumpUnresolvedFunctions then
  60. WriteLn('Unresolved: ', name);
  61. end;
  62. function InitGLUFromLibrary(libname: PChar): Boolean;
  63. begin
  64. Result := False;
  65. libGLU := LoadLibrary(libname);
  66. if libGLU = 0 then exit;
  67. %GLUProcsPL
  68. GLUInitialized := True;
  69. Result := True;
  70. end;
  71. function InitGLU: Boolean;
  72. begin
  73. Result := InitGLUFromLibrary('glu32.dll');
  74. end;
  75. initialization
  76. InitGl;
  77. finalization
  78. if libGLU <> 0 then FreeLibrary(libGLU);
  79. end.
  80. {
  81. $Log$
  82. Revision 1.1 2000-09-03 21:25:45 peter
  83. * new updated version
  84. * gtkglarea unit and demo
  85. * win32 opengl headers
  86. * morph3d demo
  87. Revision 1.1 2000/07/13 06:34:18 michael
  88. + Initial import
  89. Revision 1.1 2000/05/31 00:35:14 alex
  90. added working templates
  91. }