glx_sl.pp 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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_SL;
  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. // =======================================================
  41. // GLX consts, types and functions
  42. // =======================================================
  43. // Tokens for glXChooseVisual and glXGetConfig:
  44. const
  45. GLX_USE_GL = 1;
  46. GLX_BUFFER_SIZE = 2;
  47. GLX_LEVEL = 3;
  48. GLX_RGBA = 4;
  49. GLX_DOUBLEBUFFER = 5;
  50. GLX_STEREO = 6;
  51. GLX_AUX_BUFFERS = 7;
  52. GLX_RED_SIZE = 8;
  53. GLX_GREEN_SIZE = 9;
  54. GLX_BLUE_SIZE = 10;
  55. GLX_ALPHA_SIZE = 11;
  56. GLX_DEPTH_SIZE = 12;
  57. GLX_STENCIL_SIZE = 13;
  58. GLX_ACCUM_RED_SIZE = 14;
  59. GLX_ACCUM_GREEN_SIZE = 15;
  60. GLX_ACCUM_BLUE_SIZE = 16;
  61. GLX_ACCUM_ALPHA_SIZE = 17;
  62. // GLX_EXT_visual_info extension
  63. GLX_X_VISUAL_TYPE_EXT = $22;
  64. GLX_TRANSPARENT_TYPE_EXT = $23;
  65. GLX_TRANSPARENT_INDEX_VALUE_EXT = $24;
  66. GLX_TRANSPARENT_RED_VALUE_EXT = $25;
  67. GLX_TRANSPARENT_GREEN_VALUE_EXT = $26;
  68. GLX_TRANSPARENT_BLUE_VALUE_EXT = $27;
  69. GLX_TRANSPARENT_ALPHA_VALUE_EXT = $28;
  70. // Error codes returned by glXGetConfig:
  71. GLX_BAD_SCREEN = 1;
  72. GLX_BAD_ATTRIBUTE = 2;
  73. GLX_NO_EXTENSION = 3;
  74. GLX_BAD_VISUAL = 4;
  75. GLX_BAD_CONTEXT = 5;
  76. GLX_BAD_VALUE = 6;
  77. GLX_BAD_ENUM = 7;
  78. // GLX 1.1 and later:
  79. GLX_VENDOR = 1;
  80. GLX_VERSION = 2;
  81. GLX_EXTENSIONS = 3;
  82. // GLX_visual_info extension
  83. GLX_TRUE_COLOR_EXT = $8002;
  84. GLX_DIRECT_COLOR_EXT = $8003;
  85. GLX_PSEUDO_COLOR_EXT = $8004;
  86. GLX_STATIC_COLOR_EXT = $8005;
  87. GLX_GRAY_SCALE_EXT = $8006;
  88. GLX_STATIC_GRAY_EXT = $8007;
  89. GLX_NONE_EXT = $8000;
  90. GLX_TRANSPARENT_RGB_EXT = $8008;
  91. GLX_TRANSPARENT_INDEX_EXT = $8009;
  92. type
  93. // From XLib:
  94. XPixmap = TXID;
  95. XFont = TXID;
  96. XColormap = TXID;
  97. GLXContext = Pointer;
  98. GLXPixmap = TXID;
  99. GLXDrawable = TXID;
  100. GLXContextID = TXID;
  101. function glXChooseVisual(dpy: PDisplay; screen: Integer; var attribList: Integer): PXVisualInfo; cdecl; glx_dll;
  102. function glXCreateContext(dpy: PDisplay; vis: PXVisualInfo; shareList: GLXContext; direct: Boolean): GLXContext; cdecl; glx_dll;
  103. procedure glXDestroyContext(dpy: PDisplay; ctx: GLXContext); cdecl; glx_dll;
  104. function glXMakeCurrent(dpy: PDisplay; drawable: GLXDrawable; ctx: GLXContext): Boolean; cdecl; glx_dll;
  105. procedure glXCopyContext(dpy: PDisplay; src, dst: GLXContext; mask: LongWord); cdecl; glx_dll;
  106. procedure glXSwapBuffers(dpy: PDisplay; drawable: GLXDrawable); cdecl; glx_dll;
  107. function glXCreateGLXPixmap(dpy: PDisplay; visual: PXVisualInfo; pixmap: XPixmap): GLXPixmap; cdecl; glx_dll;
  108. procedure glXDestroyGLXPixmap(dpy: PDisplay; pixmap: GLXPixmap); cdecl; glx_dll;
  109. function glXQueryExtension(dpy: PDisplay; var errorb, event: Integer): Boolean; cdecl; glx_dll;
  110. function glXQueryVersion(dpy: PDisplay; var maj, min: Integer): Boolean; cdecl; glx_dll;
  111. function glXIsDirect(dpy: PDisplay; ctx: GLXContext): Boolean; cdecl; glx_dll;
  112. function glXGetConfig(dpy: PDisplay; visual: PXVisualInfo; attrib: Integer; var value: Integer): Integer; cdecl; glx_dll;
  113. function glXGetCurrentContext: GLXContext; cdecl; glx_dll;
  114. function glXGetCurrentDrawable: GLXDrawable; cdecl; glx_dll;
  115. procedure glXWaitGL; cdecl; glx_dll;
  116. procedure glXWaitX; cdecl; glx_dll;
  117. procedure glXUseXFont(font: XFont; first, count, list: Integer); cdecl; glx_dll;
  118. // GLX 1.1 and later
  119. function glXQueryExtensionsString(dpy: PDisplay; screen: Integer): PChar; cdecl; glx_dll;
  120. function glXQueryServerString(dpy: PDisplay; screen, name: Integer): PChar; cdecl; glx_dll;
  121. function glXGetClientString(dpy: PDisplay; name: Integer): PChar; cdecl; glx_dll;
  122. // Mesa GLX Extensions
  123. function glXCreateGLXPixmapMESA(dpy: PDisplay; visual: PXVisualInfo; pixmap: XPixmap; cmap: XColormap): GLXPixmap; cdecl; glx_dll;
  124. function glXReleaseBufferMESA(dpy: PDisplay; d: GLXDrawable): Boolean; cdecl; glx_dll;
  125. procedure glXCopySubBufferMESA(dpy: PDisplay; drawbale: GLXDrawable; x, y, width, height: Integer); cdecl; glx_dll;
  126. function glXGetVideoSyncSGI(var counter: LongWord): Integer; cdecl; glx_dll;
  127. function glXWaitVideoSyncSGI(divisor, remainder: Integer; var count: LongWord): Integer; cdecl; glx_dll;
  128. // =======================================================
  129. //
  130. // =======================================================
  131. implementation
  132. end.
  133. {
  134. $Log$
  135. Revision 1.3 2000-10-01 22:17:59 peter
  136. * new bounce demo
  137. Revision 1.1.2.2 2000/10/01 22:12:28 peter
  138. * new demo
  139. Revision 1.1 2000/09/03 21:25:45 peter
  140. * new updated version
  141. * gtkglarea unit and demo
  142. * win32 opengl headers
  143. * morph3d demo
  144. Revision 1.1 2000/07/13 06:34:18 michael
  145. + Initial import
  146. Revision 1.1 2000/05/31 00:36:08 alex
  147. dummy - incomplete code.
  148. }
  149. {
  150. $Log$
  151. Revision 1.3 2000-10-01 22:17:59 peter
  152. * new bounce demo
  153. Revision 1.1.2.2 2000/10/01 22:12:28 peter
  154. * new demo
  155. }