glx.nim 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. #
  2. #
  3. # Translation of the Mesa GLX headers for FreePascal
  4. # Copyright (C) 1999 Sebastian Guenther
  5. #
  6. #
  7. # Mesa 3-D graphics library
  8. # Version: 3.0
  9. # Copyright (C) 1995-1998 Brian Paul
  10. #
  11. # This library is free software; you can redistribute it and/or
  12. # modify it under the terms of the GNU Library General Public
  13. # License as published by the Free Software Foundation; either
  14. # version 2 of the License, or (at your option) any later version.
  15. #
  16. # This library is distributed in the hope that it will be useful,
  17. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. # Library General Public License for more details.
  20. #
  21. # You should have received a copy of the GNU Library General Public
  22. # License along with this library; if not, write to the Free
  23. # Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  24. #
  25. import
  26. X, XLib, XUtil, gl
  27. when defined(windows):
  28. const
  29. dllname = "GL.dll"
  30. elif defined(macosx):
  31. const
  32. dllname = "/usr/X11R6/lib/libGL.dylib"
  33. else:
  34. const
  35. dllname = "libGL.so"
  36. const
  37. GLX_USE_GL* = 1
  38. GLX_BUFFER_SIZE* = 2
  39. GLX_LEVEL* = 3
  40. GLX_RGBA* = 4
  41. GLX_DOUBLEBUFFER* = 5
  42. GLX_STEREO* = 6
  43. GLX_AUX_BUFFERS* = 7
  44. GLX_RED_SIZE* = 8
  45. GLX_GREEN_SIZE* = 9
  46. GLX_BLUE_SIZE* = 10
  47. GLX_ALPHA_SIZE* = 11
  48. GLX_DEPTH_SIZE* = 12
  49. GLX_STENCIL_SIZE* = 13
  50. GLX_ACCUM_RED_SIZE* = 14
  51. GLX_ACCUM_GREEN_SIZE* = 15
  52. GLX_ACCUM_BLUE_SIZE* = 16
  53. GLX_ACCUM_ALPHA_SIZE* = 17 # GLX_EXT_visual_info extension
  54. GLX_X_VISUAL_TYPE_EXT* = 0x00000022
  55. GLX_TRANSPARENT_TYPE_EXT* = 0x00000023
  56. GLX_TRANSPARENT_INDEX_VALUE_EXT* = 0x00000024
  57. GLX_TRANSPARENT_RED_VALUE_EXT* = 0x00000025
  58. GLX_TRANSPARENT_GREEN_VALUE_EXT* = 0x00000026
  59. GLX_TRANSPARENT_BLUE_VALUE_EXT* = 0x00000027
  60. GLX_TRANSPARENT_ALPHA_VALUE_EXT* = 0x00000028 # Error codes returned by glXGetConfig:
  61. GLX_BAD_SCREEN* = 1
  62. GLX_BAD_ATTRIBUTE* = 2
  63. GLX_NO_EXTENSION* = 3
  64. GLX_BAD_VISUAL* = 4
  65. GLX_BAD_CONTEXT* = 5
  66. GLX_BAD_VALUE* = 6
  67. GLX_BAD_ENUM* = 7 # GLX 1.1 and later:
  68. GLX_VENDOR* = 1
  69. GLX_VERSION* = 2
  70. GLX_EXTENSIONS* = 3 # GLX_visual_info extension
  71. GLX_TRUE_COLOR_EXT* = 0x00008002
  72. GLX_DIRECT_COLOR_EXT* = 0x00008003
  73. GLX_PSEUDO_COLOR_EXT* = 0x00008004
  74. GLX_STATIC_COLOR_EXT* = 0x00008005
  75. GLX_GRAY_SCALE_EXT* = 0x00008006
  76. GLX_STATIC_GRAY_EXT* = 0x00008007
  77. GLX_NONE_EXT* = 0x00008000
  78. GLX_TRANSPARENT_RGB_EXT* = 0x00008008
  79. GLX_TRANSPARENT_INDEX_EXT* = 0x00008009
  80. type # From XLib:
  81. XPixmap* = TXID
  82. XFont* = TXID
  83. XColormap* = TXID
  84. GLXContext* = Pointer
  85. GLXPixmap* = TXID
  86. GLXDrawable* = TXID
  87. GLXContextID* = TXID
  88. TXPixmap* = XPixmap
  89. TXFont* = XFont
  90. TXColormap* = XColormap
  91. TGLXContext* = GLXContext
  92. TGLXPixmap* = GLXPixmap
  93. TGLXDrawable* = GLXDrawable
  94. TGLXContextID* = GLXContextID
  95. proc glXChooseVisual*(dpy: PDisplay, screen: int, attribList: ptr int32): PXVisualInfo{.
  96. cdecl, dynlib: dllname, importc: "glXChooseVisual".}
  97. proc glXCreateContext*(dpy: PDisplay, vis: PXVisualInfo, shareList: GLXContext,
  98. direct: bool): GLXContext{.cdecl, dynlib: dllname,
  99. importc: "glXCreateContext".}
  100. proc glXDestroyContext*(dpy: PDisplay, ctx: GLXContext){.cdecl, dynlib: dllname,
  101. importc: "glXDestroyContext".}
  102. proc glXMakeCurrent*(dpy: PDisplay, drawable: GLXDrawable, ctx: GLXContext): bool{.
  103. cdecl, dynlib: dllname, importc: "glXMakeCurrent".}
  104. proc glXCopyContext*(dpy: PDisplay, src, dst: GLXContext, mask: int32){.cdecl,
  105. dynlib: dllname, importc: "glXCopyContext".}
  106. proc glXSwapBuffers*(dpy: PDisplay, drawable: GLXDrawable){.cdecl,
  107. dynlib: dllname, importc: "glXSwapBuffers".}
  108. proc glXCreateGLXPixmap*(dpy: PDisplay, visual: PXVisualInfo, pixmap: XPixmap): GLXPixmap{.
  109. cdecl, dynlib: dllname, importc: "glXCreateGLXPixmap".}
  110. proc glXDestroyGLXPixmap*(dpy: PDisplay, pixmap: GLXPixmap){.cdecl,
  111. dynlib: dllname, importc: "glXDestroyGLXPixmap".}
  112. proc glXQueryExtension*(dpy: PDisplay, errorb, event: var int): bool{.cdecl,
  113. dynlib: dllname, importc: "glXQueryExtension".}
  114. proc glXQueryVersion*(dpy: PDisplay, maj, min: var int): bool{.cdecl,
  115. dynlib: dllname, importc: "glXQueryVersion".}
  116. proc glXIsDirect*(dpy: PDisplay, ctx: GLXContext): bool{.cdecl, dynlib: dllname,
  117. importc: "glXIsDirect".}
  118. proc glXGetConfig*(dpy: PDisplay, visual: PXVisualInfo, attrib: int,
  119. value: var int): int{.cdecl, dynlib: dllname,
  120. importc: "glXGetConfig".}
  121. proc glXGetCurrentContext*(): GLXContext{.cdecl, dynlib: dllname,
  122. importc: "glXGetCurrentContext".}
  123. proc glXGetCurrentDrawable*(): GLXDrawable{.cdecl, dynlib: dllname,
  124. importc: "glXGetCurrentDrawable".}
  125. proc glXWaitGL*(){.cdecl, dynlib: dllname, importc: "glXWaitGL".}
  126. proc glXWaitX*(){.cdecl, dynlib: dllname, importc: "glXWaitX".}
  127. proc glXUseXFont*(font: XFont, first, count, list: int){.cdecl, dynlib: dllname,
  128. importc: "glXUseXFont".}
  129. # GLX 1.1 and later
  130. proc glXQueryExtensionsString*(dpy: PDisplay, screen: int): cstring{.cdecl,
  131. dynlib: dllname, importc: "glXQueryExtensionsString".}
  132. proc glXQueryServerString*(dpy: PDisplay, screen, name: int): cstring{.cdecl,
  133. dynlib: dllname, importc: "glXQueryServerString".}
  134. proc glXGetClientString*(dpy: PDisplay, name: int): cstring{.cdecl,
  135. dynlib: dllname, importc: "glXGetClientString".}
  136. # Mesa GLX Extensions
  137. proc glXCreateGLXPixmapMESA*(dpy: PDisplay, visual: PXVisualInfo,
  138. pixmap: XPixmap, cmap: XColormap): GLXPixmap{.
  139. cdecl, dynlib: dllname, importc: "glXCreateGLXPixmapMESA".}
  140. proc glXReleaseBufferMESA*(dpy: PDisplay, d: GLXDrawable): bool{.cdecl,
  141. dynlib: dllname, importc: "glXReleaseBufferMESA".}
  142. proc glXCopySubBufferMESA*(dpy: PDisplay, drawbale: GLXDrawable,
  143. x, y, width, height: int){.cdecl, dynlib: dllname,
  144. importc: "glXCopySubBufferMESA".}
  145. proc glXGetVideoSyncSGI*(counter: var int32): int{.cdecl, dynlib: dllname,
  146. importc: "glXGetVideoSyncSGI".}
  147. proc glXWaitVideoSyncSGI*(divisor, remainder: int, count: var int32): int{.
  148. cdecl, dynlib: dllname, importc: "glXWaitVideoSyncSGI".}
  149. # implementation