glut.nim 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. #
  2. #
  3. # Adaption of the delphi3d.net OpenGL units to FreePascal
  4. # Sebastian Guenther (sg@freepascal.org) in 2002
  5. # These units are free to use
  6. #
  7. # Copyright (c) Mark J. Kilgard, 1994, 1995, 1996.
  8. # This program is freely distributable without licensing fees and is
  9. # provided without guarantee or warrantee expressed or implied. This
  10. # program is -not- in the public domain.
  11. #******************************************************************************
  12. # Converted to Delphi by Tom Nuydens (tom@delphi3d.net)
  13. # Contributions by Igor Karpov (glygrik@hotbox.ru)
  14. # For the latest updates, visit Delphi3D: http://www.delphi3d.net
  15. #******************************************************************************
  16. import
  17. GL
  18. when defined(windows):
  19. const
  20. dllname = "glut32.dll"
  21. elif defined(macosx):
  22. const
  23. dllname = "/System/Library/Frameworks/GLUT.framework/GLUT"
  24. else:
  25. const
  26. dllname = "libglut.so.3"
  27. type
  28. TGlutVoidCallback* = proc (){.cdecl.}
  29. TGlut1IntCallback* = proc (value: cint){.cdecl.}
  30. TGlut2IntCallback* = proc (v1, v2: cint){.cdecl.}
  31. TGlut3IntCallback* = proc (v1, v2, v3: cint){.cdecl.}
  32. TGlut4IntCallback* = proc (v1, v2, v3, v4: cint){.cdecl.}
  33. TGlut1Char2IntCallback* = proc (c: int8, v1, v2: cint){.cdecl.}
  34. TGlut1UInt3IntCallback* = proc (u, v1, v2, v3: cint){.cdecl.}
  35. const
  36. GLUT_API_VERSION* = 3
  37. GLUT_XLIB_IMPLEMENTATION* = 12 # Display mode bit masks.
  38. GLUT_RGB* = 0
  39. GLUT_RGBA* = GLUT_RGB
  40. GLUT_INDEX* = 1
  41. GLUT_SINGLE* = 0
  42. GLUT_DOUBLE* = 2
  43. GLUT_ACCUM* = 4
  44. GLUT_ALPHA* = 8
  45. GLUT_DEPTH* = 16
  46. GLUT_STENCIL* = 32
  47. GLUT_MULTISAMPLE* = 128
  48. GLUT_STEREO* = 256
  49. GLUT_LUMINANCE* = 512 # Mouse buttons.
  50. GLUT_LEFT_BUTTON* = 0
  51. GLUT_MIDDLE_BUTTON* = 1
  52. GLUT_RIGHT_BUTTON* = 2 # Mouse button state.
  53. GLUT_DOWN* = 0
  54. GLUT_UP* = 1 # function keys
  55. GLUT_KEY_F1* = 1
  56. GLUT_KEY_F2* = 2
  57. GLUT_KEY_F3* = 3
  58. GLUT_KEY_F4* = 4
  59. GLUT_KEY_F5* = 5
  60. GLUT_KEY_F6* = 6
  61. GLUT_KEY_F7* = 7
  62. GLUT_KEY_F8* = 8
  63. GLUT_KEY_F9* = 9
  64. GLUT_KEY_F10* = 10
  65. GLUT_KEY_F11* = 11
  66. GLUT_KEY_F12* = 12 # directional keys
  67. GLUT_KEY_LEFT* = 100
  68. GLUT_KEY_UP* = 101
  69. GLUT_KEY_RIGHT* = 102
  70. GLUT_KEY_DOWN* = 103
  71. GLUT_KEY_PAGE_UP* = 104
  72. GLUT_KEY_PAGE_DOWN* = 105
  73. GLUT_KEY_HOME* = 106
  74. GLUT_KEY_END* = 107
  75. GLUT_KEY_INSERT* = 108 # Entry/exit state.
  76. GLUT_LEFT* = 0
  77. GLUT_ENTERED* = 1 # Menu usage state.
  78. GLUT_MENU_NOT_IN_USE* = 0
  79. GLUT_MENU_IN_USE* = 1 # Visibility state.
  80. GLUT_NOT_VISIBLE* = 0
  81. GLUT_VISIBLE* = 1 # Window status state.
  82. GLUT_HIDDEN* = 0
  83. GLUT_FULLY_RETAINED* = 1
  84. GLUT_PARTIALLY_RETAINED* = 2
  85. GLUT_FULLY_COVERED* = 3 # Color index component selection values.
  86. GLUT_RED* = 0
  87. GLUT_GREEN* = 1
  88. GLUT_BLUE* = 2 # Layers for use.
  89. GLUT_NORMAL* = 0
  90. GLUT_OVERLAY* = 1
  91. when defined(Windows):
  92. const # Stroke font constants (use these in GLUT program).
  93. GLUT_STROKE_ROMAN* = cast[Pointer](0)
  94. GLUT_STROKE_MONO_ROMAN* = cast[Pointer](1) # Bitmap font constants (use these in GLUT program).
  95. GLUT_BITMAP_9_BY_15* = cast[Pointer](2)
  96. GLUT_BITMAP_8_BY_13* = cast[Pointer](3)
  97. GLUT_BITMAP_TIMES_ROMAN_10* = cast[Pointer](4)
  98. GLUT_BITMAP_TIMES_ROMAN_24* = cast[Pointer](5)
  99. GLUT_BITMAP_HELVETICA_10* = cast[Pointer](6)
  100. GLUT_BITMAP_HELVETICA_12* = cast[Pointer](7)
  101. GLUT_BITMAP_HELVETICA_18* = cast[Pointer](8)
  102. else:
  103. var # Stroke font constants (use these in GLUT program).
  104. GLUT_STROKE_ROMAN*: Pointer
  105. GLUT_STROKE_MONO_ROMAN*: Pointer # Bitmap font constants (use these in GLUT program).
  106. GLUT_BITMAP_9_BY_15*: Pointer
  107. GLUT_BITMAP_8_BY_13*: Pointer
  108. GLUT_BITMAP_TIMES_ROMAN_10*: Pointer
  109. GLUT_BITMAP_TIMES_ROMAN_24*: Pointer
  110. GLUT_BITMAP_HELVETICA_10*: Pointer
  111. GLUT_BITMAP_HELVETICA_12*: Pointer
  112. GLUT_BITMAP_HELVETICA_18*: Pointer
  113. const # glutGet parameters.
  114. GLUT_WINDOW_X* = 100
  115. GLUT_WINDOW_Y* = 101
  116. GLUT_WINDOW_WIDTH* = 102
  117. GLUT_WINDOW_HEIGHT* = 103
  118. GLUT_WINDOW_BUFFER_SIZE* = 104
  119. GLUT_WINDOW_STENCIL_SIZE* = 105
  120. GLUT_WINDOW_DEPTH_SIZE* = 106
  121. GLUT_WINDOW_RED_SIZE* = 107
  122. GLUT_WINDOW_GREEN_SIZE* = 108
  123. GLUT_WINDOW_BLUE_SIZE* = 109
  124. GLUT_WINDOW_ALPHA_SIZE* = 110
  125. GLUT_WINDOW_ACCUM_RED_SIZE* = 111
  126. GLUT_WINDOW_ACCUM_GREEN_SIZE* = 112
  127. GLUT_WINDOW_ACCUM_BLUE_SIZE* = 113
  128. GLUT_WINDOW_ACCUM_ALPHA_SIZE* = 114
  129. GLUT_WINDOW_DOUBLEBUFFER* = 115
  130. GLUT_WINDOW_RGBA* = 116
  131. GLUT_WINDOW_PARENT* = 117
  132. GLUT_WINDOW_NUM_CHILDREN* = 118
  133. GLUT_WINDOW_COLORMAP_SIZE* = 119
  134. GLUT_WINDOW_NUM_SAMPLES* = 120
  135. GLUT_WINDOW_STEREO* = 121
  136. GLUT_WINDOW_CURSOR* = 122
  137. GLUT_SCREEN_WIDTH* = 200
  138. GLUT_SCREEN_HEIGHT* = 201
  139. GLUT_SCREEN_WIDTH_MM* = 202
  140. GLUT_SCREEN_HEIGHT_MM* = 203
  141. GLUT_MENU_NUM_ITEMS* = 300
  142. GLUT_DISPLAY_MODE_POSSIBLE* = 400
  143. GLUT_INIT_WINDOW_X* = 500
  144. GLUT_INIT_WINDOW_Y* = 501
  145. GLUT_INIT_WINDOW_WIDTH* = 502
  146. GLUT_INIT_WINDOW_HEIGHT* = 503
  147. constGLUT_INIT_DISPLAY_MODE* = 504
  148. GLUT_ELAPSED_TIME* = 700
  149. GLUT_WINDOW_FORMAT_ID* = 123 # glutDeviceGet parameters.
  150. GLUT_HAS_KEYBOARD* = 600
  151. GLUT_HAS_MOUSE* = 601
  152. GLUT_HAS_SPACEBALL* = 602
  153. GLUT_HAS_DIAL_AND_BUTTON_BOX* = 603
  154. GLUT_HAS_TABLET* = 604
  155. GLUT_NUM_MOUSE_BUTTONS* = 605
  156. GLUT_NUM_SPACEBALL_BUTTONS* = 606
  157. GLUT_NUM_BUTTON_BOX_BUTTONS* = 607
  158. GLUT_NUM_DIALS* = 608
  159. GLUT_NUM_TABLET_BUTTONS* = 609
  160. GLUT_DEVICE_IGNORE_KEY_REPEAT* = 610
  161. GLUT_DEVICE_KEY_REPEAT* = 611
  162. GLUT_HAS_JOYSTICK* = 612
  163. GLUT_OWNS_JOYSTICK* = 613
  164. GLUT_JOYSTICK_BUTTONS* = 614
  165. GLUT_JOYSTICK_AXES* = 615
  166. GLUT_JOYSTICK_POLL_RATE* = 616 # glutLayerGet parameters.
  167. GLUT_OVERLAY_POSSIBLE* = 800
  168. GLUT_LAYER_IN_USE* = 801
  169. GLUT_HAS_OVERLAY* = 802
  170. GLUT_TRANSPARENT_INDEX* = 803
  171. GLUT_NORMAL_DAMAGED* = 804
  172. GLUT_OVERLAY_DAMAGED* = 805 # glutVideoResizeGet parameters.
  173. GLUT_VIDEO_RESIZE_POSSIBLE* = 900
  174. GLUT_VIDEO_RESIZE_IN_USE* = 901
  175. GLUT_VIDEO_RESIZE_X_DELTA* = 902
  176. GLUT_VIDEO_RESIZE_Y_DELTA* = 903
  177. GLUT_VIDEO_RESIZE_WIDTH_DELTA* = 904
  178. GLUT_VIDEO_RESIZE_HEIGHT_DELTA* = 905
  179. GLUT_VIDEO_RESIZE_X* = 906
  180. GLUT_VIDEO_RESIZE_Y* = 907
  181. GLUT_VIDEO_RESIZE_WIDTH* = 908
  182. GLUT_VIDEO_RESIZE_HEIGHT* = 909 # glutGetModifiers return mask.
  183. GLUT_ACTIVE_SHIFT* = 1
  184. GLUT_ACTIVE_CTRL* = 2
  185. GLUT_ACTIVE_ALT* = 4 # glutSetCursor parameters.
  186. # Basic arrows.
  187. GLUT_CURSOR_RIGHT_ARROW* = 0
  188. GLUT_CURSOR_LEFT_ARROW* = 1 # Symbolic cursor shapes.
  189. GLUT_CURSOR_INFO* = 2
  190. GLUT_CURSOR_DESTROY* = 3
  191. GLUT_CURSOR_HELP* = 4
  192. GLUT_CURSOR_CYCLE* = 5
  193. GLUT_CURSOR_SPRAY* = 6
  194. GLUT_CURSOR_WAIT* = 7
  195. GLUT_CURSOR_TEXT* = 8
  196. GLUT_CURSOR_CROSSHAIR* = 9 # Directional cursors.
  197. GLUT_CURSOR_UP_DOWN* = 10
  198. GLUT_CURSOR_LEFT_RIGHT* = 11 # Sizing cursors.
  199. GLUT_CURSOR_TOP_SIDE* = 12
  200. GLUT_CURSOR_BOTTOM_SIDE* = 13
  201. GLUT_CURSOR_LEFT_SIDE* = 14
  202. GLUT_CURSOR_RIGHT_SIDE* = 15
  203. GLUT_CURSOR_TOP_LEFT_CORNER* = 16
  204. GLUT_CURSOR_TOP_RIGHT_CORNER* = 17
  205. GLUT_CURSOR_BOTTOM_RIGHT_CORNER* = 18
  206. GLUT_CURSOR_BOTTOM_LEFT_CORNER* = 19 # Inherit from parent window.
  207. GLUT_CURSOR_INHERIT* = 100 # Blank cursor.
  208. GLUT_CURSOR_NONE* = 101 # Fullscreen crosshair (if available).
  209. GLUT_CURSOR_FULL_CROSSHAIR* = 102 # GLUT device control sub-API.
  210. # glutSetKeyRepeat modes.
  211. GLUT_KEY_REPEAT_OFF* = 0
  212. GLUT_KEY_REPEAT_ON* = 1
  213. GLUT_KEY_REPEAT_DEFAULT* = 2 # Joystick button masks.
  214. GLUT_JOYSTICK_BUTTON_A* = 1
  215. GLUT_JOYSTICK_BUTTON_B* = 2
  216. GLUT_JOYSTICK_BUTTON_C* = 4
  217. GLUT_JOYSTICK_BUTTON_D* = 8 # GLUT game mode sub-API.
  218. # glutGameModeGet.
  219. GLUT_GAME_MODE_ACTIVE* = 0
  220. GLUT_GAME_MODE_POSSIBLE* = 1
  221. GLUT_GAME_MODE_WIDTH* = 2
  222. GLUT_GAME_MODE_HEIGHT* = 3
  223. GLUT_GAME_MODE_PIXEL_DEPTH* = 4
  224. GLUT_GAME_MODE_REFRESH_RATE* = 5
  225. GLUT_GAME_MODE_DISPLAY_CHANGED* = 6 # GLUT initialization sub-API.
  226. proc glutInit*(argcp: ptr cint, argv: pointer){.dynlib: dllname,
  227. importc: "glutInit".}
  228. proc glutInit*() =
  229. ## version that passes `argc` and `argc` implicitely.
  230. var
  231. cmdLine {.importc: "cmdLine".}: array[0..255, cstring]
  232. cmdCount {.importc: "cmdCount".}: cint
  233. glutInit(addr(cmdCount), addr(cmdLine))
  234. proc glutInitDisplayMode*(mode: int16){.dynlib: dllname,
  235. importc: "glutInitDisplayMode".}
  236. proc glutInitDisplayString*(str: cstring){.dynlib: dllname,
  237. importc: "glutInitDisplayString".}
  238. proc glutInitWindowPosition*(x, y: int){.dynlib: dllname,
  239. importc: "glutInitWindowPosition".}
  240. proc glutInitWindowSize*(width, height: int){.dynlib: dllname,
  241. importc: "glutInitWindowSize".}
  242. proc glutMainLoop*(){.dynlib: dllname, importc: "glutMainLoop".}
  243. # GLUT window sub-API.
  244. proc glutCreateWindow*(title: cstring): int{.dynlib: dllname,
  245. importc: "glutCreateWindow".}
  246. proc glutCreateSubWindow*(win, x, y, width, height: int): int{.dynlib: dllname,
  247. importc: "glutCreateSubWindow".}
  248. proc glutDestroyWindow*(win: int){.dynlib: dllname, importc: "glutDestroyWindow".}
  249. proc glutPostRedisplay*(){.dynlib: dllname, importc: "glutPostRedisplay".}
  250. proc glutPostWindowRedisplay*(win: int){.dynlib: dllname,
  251. importc: "glutPostWindowRedisplay".}
  252. proc glutSwapBuffers*(){.dynlib: dllname, importc: "glutSwapBuffers".}
  253. proc glutGetWindow*(): int{.dynlib: dllname, importc: "glutGetWindow".}
  254. proc glutSetWindow*(win: int){.dynlib: dllname, importc: "glutSetWindow".}
  255. proc glutSetWindowTitle*(title: cstring){.dynlib: dllname,
  256. importc: "glutSetWindowTitle".}
  257. proc glutSetIconTitle*(title: cstring){.dynlib: dllname,
  258. importc: "glutSetIconTitle".}
  259. proc glutPositionWindow*(x, y: int){.dynlib: dllname,
  260. importc: "glutPositionWindow".}
  261. proc glutReshapeWindow*(width, height: int){.dynlib: dllname,
  262. importc: "glutReshapeWindow".}
  263. proc glutPopWindow*(){.dynlib: dllname, importc: "glutPopWindow".}
  264. proc glutPushWindow*(){.dynlib: dllname, importc: "glutPushWindow".}
  265. proc glutIconifyWindow*(){.dynlib: dllname, importc: "glutIconifyWindow".}
  266. proc glutShowWindow*(){.dynlib: dllname, importc: "glutShowWindow".}
  267. proc glutHideWindow*(){.dynlib: dllname, importc: "glutHideWindow".}
  268. proc glutFullScreen*(){.dynlib: dllname, importc: "glutFullScreen".}
  269. proc glutSetCursor*(cursor: int){.dynlib: dllname, importc: "glutSetCursor".}
  270. proc glutWarpPointer*(x, y: int){.dynlib: dllname, importc: "glutWarpPointer".}
  271. # GLUT overlay sub-API.
  272. proc glutEstablishOverlay*(){.dynlib: dllname, importc: "glutEstablishOverlay".}
  273. proc glutRemoveOverlay*(){.dynlib: dllname, importc: "glutRemoveOverlay".}
  274. proc glutUseLayer*(layer: TGLenum){.dynlib: dllname, importc: "glutUseLayer".}
  275. proc glutPostOverlayRedisplay*(){.dynlib: dllname,
  276. importc: "glutPostOverlayRedisplay".}
  277. proc glutPostWindowOverlayRedisplay*(win: int){.dynlib: dllname,
  278. importc: "glutPostWindowOverlayRedisplay".}
  279. proc glutShowOverlay*(){.dynlib: dllname, importc: "glutShowOverlay".}
  280. proc glutHideOverlay*(){.dynlib: dllname, importc: "glutHideOverlay".}
  281. # GLUT menu sub-API.
  282. proc glutCreateMenu*(callback: TGlut1IntCallback): int{.dynlib: dllname,
  283. importc: "glutCreateMenu".}
  284. proc glutDestroyMenu*(menu: int){.dynlib: dllname, importc: "glutDestroyMenu".}
  285. proc glutGetMenu*(): int{.dynlib: dllname, importc: "glutGetMenu".}
  286. proc glutSetMenu*(menu: int){.dynlib: dllname, importc: "glutSetMenu".}
  287. proc glutAddMenuEntry*(caption: cstring, value: int){.dynlib: dllname,
  288. importc: "glutAddMenuEntry".}
  289. proc glutAddSubMenu*(caption: cstring, submenu: int){.dynlib: dllname,
  290. importc: "glutAddSubMenu".}
  291. proc glutChangeToMenuEntry*(item: int, caption: cstring, value: int){.
  292. dynlib: dllname, importc: "glutChangeToMenuEntry".}
  293. proc glutChangeToSubMenu*(item: int, caption: cstring, submenu: int){.
  294. dynlib: dllname, importc: "glutChangeToSubMenu".}
  295. proc glutRemoveMenuItem*(item: int){.dynlib: dllname,
  296. importc: "glutRemoveMenuItem".}
  297. proc glutAttachMenu*(button: int){.dynlib: dllname, importc: "glutAttachMenu".}
  298. proc glutDetachMenu*(button: int){.dynlib: dllname, importc: "glutDetachMenu".}
  299. # GLUT window callback sub-API.
  300. proc glutDisplayFunc*(f: TGlutVoidCallback){.dynlib: dllname,
  301. importc: "glutDisplayFunc".}
  302. proc glutReshapeFunc*(f: TGlut2IntCallback){.dynlib: dllname,
  303. importc: "glutReshapeFunc".}
  304. proc glutKeyboardFunc*(f: TGlut1Char2IntCallback){.dynlib: dllname,
  305. importc: "glutKeyboardFunc".}
  306. proc glutMouseFunc*(f: TGlut4IntCallback){.dynlib: dllname,
  307. importc: "glutMouseFunc".}
  308. proc glutMotionFunc*(f: TGlut2IntCallback){.dynlib: dllname,
  309. importc: "glutMotionFunc".}
  310. proc glutPassiveMotionFunc*(f: TGlut2IntCallback){.dynlib: dllname,
  311. importc: "glutPassiveMotionFunc".}
  312. proc glutEntryFunc*(f: TGlut1IntCallback){.dynlib: dllname,
  313. importc: "glutEntryFunc".}
  314. proc glutVisibilityFunc*(f: TGlut1IntCallback){.dynlib: dllname,
  315. importc: "glutVisibilityFunc".}
  316. proc glutIdleFunc*(f: TGlutVoidCallback){.dynlib: dllname,
  317. importc: "glutIdleFunc".}
  318. proc glutTimerFunc*(millis: int16, f: TGlut1IntCallback, value: int){.
  319. dynlib: dllname, importc: "glutTimerFunc".}
  320. proc glutMenuStateFunc*(f: TGlut1IntCallback){.dynlib: dllname,
  321. importc: "glutMenuStateFunc".}
  322. proc glutSpecialFunc*(f: TGlut3IntCallback){.dynlib: dllname,
  323. importc: "glutSpecialFunc".}
  324. proc glutSpaceballMotionFunc*(f: TGlut3IntCallback){.dynlib: dllname,
  325. importc: "glutSpaceballMotionFunc".}
  326. proc glutSpaceballRotateFunc*(f: TGlut3IntCallback){.dynlib: dllname,
  327. importc: "glutSpaceballRotateFunc".}
  328. proc glutSpaceballButtonFunc*(f: TGlut2IntCallback){.dynlib: dllname,
  329. importc: "glutSpaceballButtonFunc".}
  330. proc glutButtonBoxFunc*(f: TGlut2IntCallback){.dynlib: dllname,
  331. importc: "glutButtonBoxFunc".}
  332. proc glutDialsFunc*(f: TGlut2IntCallback){.dynlib: dllname,
  333. importc: "glutDialsFunc".}
  334. proc glutTabletMotionFunc*(f: TGlut2IntCallback){.dynlib: dllname,
  335. importc: "glutTabletMotionFunc".}
  336. proc glutTabletButtonFunc*(f: TGlut4IntCallback){.dynlib: dllname,
  337. importc: "glutTabletButtonFunc".}
  338. proc glutMenuStatusFunc*(f: TGlut3IntCallback){.dynlib: dllname,
  339. importc: "glutMenuStatusFunc".}
  340. proc glutOverlayDisplayFunc*(f: TGlutVoidCallback){.dynlib: dllname,
  341. importc: "glutOverlayDisplayFunc".}
  342. proc glutWindowStatusFunc*(f: TGlut1IntCallback){.dynlib: dllname,
  343. importc: "glutWindowStatusFunc".}
  344. proc glutKeyboardUpFunc*(f: TGlut1Char2IntCallback){.dynlib: dllname,
  345. importc: "glutKeyboardUpFunc".}
  346. proc glutSpecialUpFunc*(f: TGlut3IntCallback){.dynlib: dllname,
  347. importc: "glutSpecialUpFunc".}
  348. proc glutJoystickFunc*(f: TGlut1UInt3IntCallback, pollInterval: int){.
  349. dynlib: dllname, importc: "glutJoystickFunc".}
  350. # GLUT color index sub-API.
  351. proc glutSetColor*(cell: int, red, green, blue: TGLfloat){.dynlib: dllname,
  352. importc: "glutSetColor".}
  353. proc glutGetColor*(ndx, component: int): TGLfloat{.dynlib: dllname,
  354. importc: "glutGetColor".}
  355. proc glutCopyColormap*(win: int){.dynlib: dllname, importc: "glutCopyColormap".}
  356. # GLUT state retrieval sub-API.
  357. proc glutGet*(t: TGLenum): int{.dynlib: dllname, importc: "glutGet".}
  358. proc glutDeviceGet*(t: TGLenum): int{.dynlib: dllname, importc: "glutDeviceGet".}
  359. # GLUT extension support sub-API
  360. proc glutExtensionSupported*(name: cstring): int{.dynlib: dllname,
  361. importc: "glutExtensionSupported".}
  362. proc glutGetModifiers*(): int{.dynlib: dllname, importc: "glutGetModifiers".}
  363. proc glutLayerGet*(t: TGLenum): int{.dynlib: dllname, importc: "glutLayerGet".}
  364. # GLUT font sub-API
  365. proc glutBitmapCharacter*(font: pointer, character: int){.dynlib: dllname,
  366. importc: "glutBitmapCharacter".}
  367. proc glutBitmapWidth*(font: pointer, character: int): int{.dynlib: dllname,
  368. importc: "glutBitmapWidth".}
  369. proc glutStrokeCharacter*(font: pointer, character: int){.dynlib: dllname,
  370. importc: "glutStrokeCharacter".}
  371. proc glutStrokeWidth*(font: pointer, character: int): int{.dynlib: dllname,
  372. importc: "glutStrokeWidth".}
  373. proc glutBitmapLength*(font: pointer, str: cstring): int{.dynlib: dllname,
  374. importc: "glutBitmapLength".}
  375. proc glutStrokeLength*(font: pointer, str: cstring): int{.dynlib: dllname,
  376. importc: "glutStrokeLength".}
  377. # GLUT pre-built models sub-API
  378. proc glutWireSphere*(radius: TGLdouble, slices, stacks: TGLint){.
  379. dynlib: dllname, importc: "glutWireSphere".}
  380. proc glutSolidSphere*(radius: TGLdouble, slices, stacks: TGLint){.
  381. dynlib: dllname, importc: "glutSolidSphere".}
  382. proc glutWireCone*(base, height: TGLdouble, slices, stacks: TGLint){.
  383. dynlib: dllname, importc: "glutWireCone".}
  384. proc glutSolidCone*(base, height: TGLdouble, slices, stacks: TGLint){.
  385. dynlib: dllname, importc: "glutSolidCone".}
  386. proc glutWireCube*(size: TGLdouble){.dynlib: dllname, importc: "glutWireCube".}
  387. proc glutSolidCube*(size: TGLdouble){.dynlib: dllname, importc: "glutSolidCube".}
  388. proc glutWireTorus*(innerRadius, outerRadius: TGLdouble, sides, rings: TGLint){.
  389. dynlib: dllname, importc: "glutWireTorus".}
  390. proc glutSolidTorus*(innerRadius, outerRadius: TGLdouble, sides, rings: TGLint){.
  391. dynlib: dllname, importc: "glutSolidTorus".}
  392. proc glutWireDodecahedron*(){.dynlib: dllname, importc: "glutWireDodecahedron".}
  393. proc glutSolidDodecahedron*(){.dynlib: dllname, importc: "glutSolidDodecahedron".}
  394. proc glutWireTeapot*(size: TGLdouble){.dynlib: dllname,
  395. importc: "glutWireTeapot".}
  396. proc glutSolidTeapot*(size: TGLdouble){.dynlib: dllname,
  397. importc: "glutSolidTeapot".}
  398. proc glutWireOctahedron*(){.dynlib: dllname, importc: "glutWireOctahedron".}
  399. proc glutSolidOctahedron*(){.dynlib: dllname, importc: "glutSolidOctahedron".}
  400. proc glutWireTetrahedron*(){.dynlib: dllname, importc: "glutWireTetrahedron".}
  401. proc glutSolidTetrahedron*(){.dynlib: dllname, importc: "glutSolidTetrahedron".}
  402. proc glutWireIcosahedron*(){.dynlib: dllname, importc: "glutWireIcosahedron".}
  403. proc glutSolidIcosahedron*(){.dynlib: dllname, importc: "glutSolidIcosahedron".}
  404. # GLUT video resize sub-API.
  405. proc glutVideoResizeGet*(param: TGLenum): int{.dynlib: dllname,
  406. importc: "glutVideoResizeGet".}
  407. proc glutSetupVideoResizing*(){.dynlib: dllname,
  408. importc: "glutSetupVideoResizing".}
  409. proc glutStopVideoResizing*(){.dynlib: dllname, importc: "glutStopVideoResizing".}
  410. proc glutVideoResize*(x, y, width, height: int){.dynlib: dllname,
  411. importc: "glutVideoResize".}
  412. proc glutVideoPan*(x, y, width, height: int){.dynlib: dllname,
  413. importc: "glutVideoPan".}
  414. # GLUT debugging sub-API.
  415. proc glutReportErrors*(){.dynlib: dllname, importc: "glutReportErrors".}
  416. # GLUT device control sub-API.
  417. proc glutIgnoreKeyRepeat*(ignore: int){.dynlib: dllname,
  418. importc: "glutIgnoreKeyRepeat".}
  419. proc glutSetKeyRepeat*(repeatMode: int){.dynlib: dllname,
  420. importc: "glutSetKeyRepeat".}
  421. proc glutForceJoystickFunc*(){.dynlib: dllname, importc: "glutForceJoystickFunc".}
  422. # GLUT game mode sub-API.
  423. #example glutGameModeString('1280x1024:32@75');
  424. proc glutGameModeString*(AString: cstring){.dynlib: dllname,
  425. importc: "glutGameModeString".}
  426. proc glutEnterGameMode*(): int{.dynlib: dllname, importc: "glutEnterGameMode".}
  427. proc glutLeaveGameMode*(){.dynlib: dllname, importc: "glutLeaveGameMode".}
  428. proc glutGameModeGet*(mode: TGLenum): int{.dynlib: dllname,
  429. importc: "glutGameModeGet".}
  430. # implementation