glx_w32d.tem 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. {
  2. $Id$
  3. Translation of the Mesa GLX 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 GLX;
  25. interface
  26. {$MACRO ON}
  27. {$IFDEF Win32}
  28. {$DEFINE glx_dll := external 'unknown.dll'}
  29. uses Windows;
  30. {x$DEFINE HasGLX} // Activate GLX stuff
  31. {$ELSE}
  32. {$MESSAGE Unsupported platform.}
  33. {$ENDIF}
  34. {$IFNDEF HasGLX}
  35. {$MESSAGE GLX not present on this platform.}
  36. {$ENDIF}
  37. // =======================================================
  38. // Unit specific extensions
  39. // =======================================================
  40. // Note: Requires that the GL library has already been initialized
  41. function InitGLX: Boolean;
  42. var
  43. GLXDumpUnresolvedFunctions,
  44. GLXInitialized: Boolean;
  45. // =======================================================
  46. // GLX consts, types and functions
  47. // =======================================================
  48. %GLXDeclsIF
  49. var
  50. %GLXProcsPD
  51. // =======================================================
  52. //
  53. // =======================================================
  54. implementation
  55. type
  56. HInstance = LongWord;
  57. {$IFDEF HasGLX}
  58. var
  59. libGLX : HInstance;
  60. function GetProc(handle: HInstance; name: PChar): Pointer;
  61. begin
  62. Result := GetProcAddress(handle, name);
  63. if (Result = nil) and GLXDumpUnresolvedFunctions then
  64. WriteLn('Unresolved: ', name);
  65. end;
  66. function InitGLX: Boolean;
  67. begin
  68. Result := False;
  69. { Unix GLX is implemented as special subset of the GL interface }
  70. if libGL = 0 then exit;
  71. glXQueryVersion := GetProcAddress(libGL, 'glXQueryVersion');
  72. if @glXQueryVersion = nil then exit;
  73. %GLXProcsPL
  74. GLXInitialized := True;
  75. Result := True;
  76. end;
  77. {$ENDIF IFDEF HasGLX}
  78. initialization
  79. InitGLX;
  80. finalization
  81. if libGLX <> 0 then FreeLibrary(libGLX);
  82. end.
  83. {
  84. $Log$
  85. Revision 1.1 2000-09-03 21:25:45 peter
  86. * new updated version
  87. * gtkglarea unit and demo
  88. * win32 opengl headers
  89. * morph3d demo
  90. Revision 1.1 2000/07/13 06:34:18 michael
  91. + Initial import
  92. Revision 1.1 2000/05/31 00:36:08 alex
  93. dummy - incomplete code.
  94. }