/support/gambit/glut/glut.scm

http://github.com/dharmatech/abstracting · Scheme · 404 lines · 206 code · 97 blank · 101 comment · 0 complexity · 7af93727dd4e0d965fc12274a4576185 MD5 · raw file

  1. (include "glut-header.scm")
  2. (c-declare #<<declare-end
  3. #include <GL/gl.h>
  4. #include <GL/glu.h>
  5. #include <GL/glut.h>
  6. declare-end
  7. )
  8. ; os dependent macros:
  9. (define GLUT_STROKE_ROMAN ((c-lambda () void* "___result_voidstar = GLUT_STROKE_ROMAN;")))
  10. (define GLUT_STROKE_MONO_ROMAN ((c-lambda () void* "___result_voidstar = GLUT_STROKE_MONO_ROMAN;")))
  11. (define GLUT_BITMAP_9_BY_15 ((c-lambda () void* "___result_voidstar = GLUT_BITMAP_9_BY_15;")))
  12. (define GLUT_BITMAP_8_BY_13 ((c-lambda () void* "___result_voidstar = GLUT_BITMAP_8_BY_13;")))
  13. (define GLUT_BITMAP_TIMES_ROMAN_10 ((c-lambda () void* "___result_voidstar = GLUT_BITMAP_TIMES_ROMAN_10;")))
  14. (define GLUT_BITMAP_TIMES_ROMAN_24 ((c-lambda () void* "___result_voidstar = GLUT_BITMAP_TIMES_ROMAN_24;")))
  15. (define GLUT_BITMAP_HELVETICA_10 ((c-lambda () void* "___result_voidstar = GLUT_BITMAP_HELVETICA_10;")))
  16. (define GLUT_BITMAP_HELVETICA_12 ((c-lambda () void* "___result_voidstar = GLUT_BITMAP_HELVETICA_12;")))
  17. (define GLUT_BITMAP_HELVETICA_18 ((c-lambda () void* "___result_voidstar = GLUT_BITMAP_HELVETICA_18;")))
  18. ;; /*
  19. ;; * Initialization see fglut_init.c
  20. ;; */
  21. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  22. ;; (define basic-glut-init
  23. ;; (c-lambda () void
  24. ;; "
  25. ;; int argc = 0 ;
  26. ;; glutInit( &argc , NULL ) ; "))
  27. ;; (define glutInit (c-lambda ( int* nonnull-char-string-list ) void "glutInit"))
  28. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  29. ;; (define (glutInit argc argv)
  30. ;; ((c-lambda () void "int argc = 0 ; glutInit ( &argc , NULL ) ;")))
  31. (c-declare " int argc = 0 ; ")
  32. (define (glutInit a b)
  33. (let ((argc ((c-lambda () (pointer int) " ___result_voidstar = &argc ; "))))
  34. (let ((proc (c-lambda ( int* nonnull-char-string-list ) void "glutInit")))
  35. (proc argc '()))))
  36. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  37. (define glutInitWindowPosition (c-lambda ( int int ) void "glutInitWindowPosition"))
  38. (define glutInitWindowSize (c-lambda ( int int ) void "glutInitWindowSize"))
  39. (define glutInitDisplayMode (c-lambda ( unsigned-int ) void "glutInitDisplayMode"))
  40. (define glutInitDisplayString (c-lambda ( char-string ) void "glutInitDisplayString"))
  41. ;; /*
  42. ;; * Process loop see freeglut_main.c
  43. ;; */
  44. (define glutMainLoop (c-lambda ( ) void "glutMainLoop"))
  45. ;; /*
  46. ;; * Window management see freeglut_window.c
  47. ;; */
  48. (define glutCreateWindow (c-lambda ( char-string ) int "glutCreateWindow"))
  49. (define glutCreateSubWindow (c-lambda ( int int int int int ) int "glutCreateSubWindow"))
  50. (define glutDestroyWindow (c-lambda ( int ) void "glutDestroyWindow"))
  51. (define glutSetWindow (c-lambda ( int ) void "glutSetWindow"))
  52. (define glutGetWindow (c-lambda ( ) int "glutGetWindow"))
  53. (define glutSetWindowTitle (c-lambda ( char-string ) void "glutSetWindowTitle"))
  54. (define glutSetIconTitle (c-lambda ( char-string ) void "glutSetIconTitle"))
  55. (define glutReshapeWindow (c-lambda ( int int ) void "glutReshapeWindow"))
  56. (define glutPositionWindow (c-lambda ( int int ) void "glutPositionWindow"))
  57. (define glutShowWindow (c-lambda ( ) void "glutShowWindow"))
  58. (define glutHideWindow (c-lambda ( ) void "glutHideWindow"))
  59. (define glutIconifyWindow (c-lambda ( ) void "glutIconifyWindow"))
  60. (define glutPushWindow (c-lambda ( ) void "glutPushWindow"))
  61. (define glutPopWindow (c-lambda ( ) void "glutPopWindow"))
  62. (define glutFullScreen (c-lambda ( ) void "glutFullScreen"))
  63. ;; /*
  64. ;; * Display-connected see freeglut_display.c
  65. ;; */
  66. (define glutPostWindowRedisplay (c-lambda ( int ) void "glutPostWindowRedisplay"))
  67. (define glutPostRedisplay (c-lambda ( ) void "glutPostRedisplay"))
  68. (define glutSwapBuffers (c-lambda ( ) void "glutSwapBuffers"))
  69. ;; /*
  70. ;; * Mouse cursor see freeglut_cursor.c
  71. ;; */
  72. (define glutWarpPointer (c-lambda ( int int ) void "glutWarpPointer"))
  73. (define glutSetCursor (c-lambda ( int ) void "glutSetCursor"))
  74. ;; /*
  75. ;; * Overlay see freeglut_overlay.c
  76. ;; */
  77. (define glutEstablishOverlay (c-lambda ( ) void "glutEstablishOverlay"))
  78. (define glutRemoveOverlay (c-lambda ( ) void "glutRemoveOverlay"))
  79. (define glutUseLayer (c-lambda ( GLenum ) void "glutUseLayer"))
  80. (define glutPostOverlayRedisplay (c-lambda ( ) void "glutPostOverlayRedisplay"))
  81. (define glutPostWindowOverlayRedisplay (c-lambda ( int ) void "glutPostWindowOverlayRedisplay"))
  82. (define glutShowOverlay (c-lambda ( ) void "glutShowOverlay"))
  83. (define glutHideOverlay (c-lambda ( ) void "glutHideOverlay"))
  84. ;; /*
  85. ;; * Menu see freeglut_menu.c
  86. ;; */
  87. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  88. ;; (define glutCreateMenu (c-lambda ( (function (int) void) ) int "glutCreateMenu"))
  89. (define *glut-create-menu-func* #f)
  90. (c-define (basic-create-menu-func a)
  91. (int)
  92. void
  93. "basicCreateMenuFunc"
  94. ""
  95. (*glut-create-menu-func* a))
  96. (define (glutCreateMenu proc)
  97. (set! *glut-create-menu-func* proc)
  98. ((c-lambda () void " glutCreateMenu ( basicCreateMenuFunc ) ; ")))
  99. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  100. (define glutDestroyMenu (c-lambda ( int ) void "glutDestroyMenu"))
  101. (define glutGetMenu (c-lambda ( ) int "glutGetMenu"))
  102. (define glutSetMenu (c-lambda ( int ) void "glutSetMenu"))
  103. (define glutAddMenuEntry (c-lambda ( char-string int ) void "glutAddMenuEntry"))
  104. (define glutAddSubMenu (c-lambda ( char-string int ) void "glutAddSubMenu"))
  105. (define glutChangeToMenuEntry (c-lambda ( int char-string int ) void "glutChangeToMenuEntry"))
  106. (define glutChangeToSubMenu (c-lambda ( int char-string int ) void "glutChangeToSubMenu"))
  107. (define glutRemoveMenuItem (c-lambda ( int ) void "glutRemoveMenuItem"))
  108. (define glutAttachMenu (c-lambda ( int ) void "glutAttachMenu"))
  109. (define glutDetachMenu (c-lambda ( int ) void "glutDetachMenu"))
  110. ;; /*
  111. ;; * Global callback see freeglut_callbacks.c
  112. ;; */
  113. (define glutTimerFunc (c-lambda ( unsigned-int (function (int) void) int ) void "glutTimerFunc"))
  114. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  115. ;; (define glutIdleFunc (c-lambda ( (function () void) ) void "glutIdleFunc"))
  116. (define *glut-idle-func* #f)
  117. (c-define (basic-idle-func)
  118. ()
  119. void
  120. "basicIdleFunc"
  121. ""
  122. (*glut-idle-func*))
  123. (define (glutIdleFunc proc)
  124. (set! *glut-idle-func* proc)
  125. ((c-lambda () void " glutIdleFunc ( basicIdleFunc ) ; ")))
  126. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  127. ;; /*
  128. ;; * Window-specific callback see freeglut_callbacks.c
  129. ;; */
  130. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  131. ;; (define glutKeyboardFunc (c-lambda ( (function (unsigned-char int int) void) ) void "glutKeyboardFunc"))
  132. (define *glut-keyboard-func* #f)
  133. (c-define (basic-keyboard-func a b c)
  134. (unsigned-char int int)
  135. void
  136. "basicKeyboardFunc"
  137. ""
  138. (*glut-keyboard-func* a b c))
  139. (define (glutKeyboardFunc proc)
  140. (set! *glut-keyboard-func* proc)
  141. ((c-lambda () void " glutKeyboardFunc ( basicKeyboardFunc ) ; ")))
  142. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  143. ;; (define glutSpecialFunc (c-lambda ( (function (int int int) void) ) void "glutSpecialFunc"))
  144. (define *glut-special-func* #f)
  145. (c-define (basic-special-func a b c)
  146. (int int int)
  147. void
  148. "basicSpecialFunc"
  149. ""
  150. (*glut-special-func* a b c))
  151. (define (glutSpecialFunc proc)
  152. (set! *glut-special-func* proc)
  153. ((c-lambda () void " glutSpecialFunc ( basicSpecialFunc ) ; ")))
  154. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  155. ;; (define glut-reshape-func #f)
  156. ;; (c-define (basic-reshape-func width height)
  157. ;; (int int)
  158. ;; void
  159. ;; "basicReshapeFunc"
  160. ;; ""
  161. ;; (glut-reshape-func width height))
  162. ;; (define glutReshapeFunc
  163. ;; (c-lambda (scheme-object) void "glutReshapeFunc( basicReshapeFunc ) ;"))
  164. ;; (define (glutReshapeFunc proc)
  165. ;; (set! glut-reshape-func proc)
  166. ;; ((c-lambda () void "glutReshapeFunc( basicReshapeFunc ) ;")))
  167. ;; (define glutReshapeFunc (c-lambda ( (function (int int) void) ) void "glutReshapeFunc"))
  168. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  169. (define *glut-reshape-func* #f)
  170. (c-define (basic-reshape-func width height)
  171. (int int)
  172. void
  173. "basicReshapeFunc"
  174. ""
  175. (*glut-reshape-func* width height))
  176. (define (glutReshapeFunc proc)
  177. (set! *glut-reshape-func* proc)
  178. ((c-lambda () void " glutReshapeFunc ( basicReshapeFunc ) ; ")))
  179. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  180. (define glutVisibilityFunc (c-lambda ( (function (int) void) ) void "glutVisibilityFunc"))
  181. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  182. ;; (define glutDisplayFunc (c-lambda ( (function () void) ) void "glutDisplayFunc"))
  183. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  184. (define *glut-display-func* #f)
  185. (c-define (basid-display-func)
  186. ()
  187. void
  188. "basicDisplayFunc"
  189. ""
  190. (*glut-display-func*))
  191. (define (glutDisplayFunc proc)
  192. (set! *glut-display-func* proc)
  193. ((c-lambda () void " glutDisplayFunc ( basicDisplayFunc ) ; ")))
  194. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  195. ;; (define glutMouseFunc (c-lambda ( (function (int int int int) void) ) void "glutMouseFunc"))
  196. (define *glut-mouse-func* #f)
  197. (c-define (basic-mouse-func a b c d)
  198. (int int int int)
  199. void
  200. "basicMouseFunc"
  201. ""
  202. (*glut-mouse-func* a b c d))
  203. (define (glutMouseFunc proc)
  204. (set! *glut-mouse-func* proc)
  205. ((c-lambda () void " glutMouseFunc ( basicMouseFunc ) ; ")))
  206. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  207. (define glutMotionFunc (c-lambda ( (function (int int) void ) ) void "glutMotionFunc"))
  208. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  209. ;; (define glutPassiveMotionFunc (c-lambda ( (function (int int) void) ) void "glutPassiveMotionFunc"))
  210. (define *glut-passive-motion-func* #f)
  211. (c-define (basic-passive-motion-func a b)
  212. (int int)
  213. void
  214. "basicPassiveMotionFunc"
  215. ""
  216. (*glut-passive-motion-func* a b))
  217. (define (glutPassiveMotionFunc proc)
  218. (set! *glut-passive-motion-func* proc)
  219. ((c-lambda () void " glutPassiveMotionFunc ( basicPassiveMotionFunc ) ; ")))
  220. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  221. (define glutEntryFunc (c-lambda ( (function (int) void) ) void "glutEntryFunc"))
  222. (define glutKeyboardUpFunc (c-lambda ( (function (unsigned-char int int) void) ) void "glutKeyboardUpFunc"))
  223. (define glutSpecialUpFunc (c-lambda ( (function (int int int) void) ) void "glutSpecialUpFunc"))
  224. (define glutJoystickFunc (c-lambda ( (function (unsigned-int int int int) void) int ) void "glutJoystickFunc"))
  225. (define glutMenuStateFunc (c-lambda ( (function (int) void) ) void "glutMenuStateFunc"))
  226. (define glutMenuStatusFunc (c-lambda ( (function (int int int) void) ) void "glutMenuStatusFunc"))
  227. (define glutOverlayDisplayFunc (c-lambda ( (function () void) ) void "glutOverlayDisplayFunc"))
  228. (define glutWindowStatusFunc (c-lambda ( (function (int) void) ) void "glutWindowStatusFunc"))
  229. (define glutSpaceballMotionFunc (c-lambda ( (function (int int int) void) ) void "glutSpaceballMotionFunc"))
  230. (define glutSpaceballRotateFunc (c-lambda ( (function (int int int) void) ) void "glutSpaceballRotateFunc"))
  231. (define glutSpaceballButtonFunc (c-lambda ( (function (int int) void) ) void "glutSpaceballButtonFunc"))
  232. (define glutButtonBoxFunc (c-lambda ( (function (int int) void) ) void "glutButtonBoxFunc"))
  233. (define glutDialsFunc (c-lambda ( (function (int int) void) ) void "glutDialsFunc"))
  234. (define glutTabletMotionFunc (c-lambda ( (function (int int) void) ) void "glutTabletMotionFunc"))
  235. (define glutTabletButtonFunc (c-lambda ( (function (int int int int) void) ) void "glutTabletButtonFunc"))
  236. ;; /*
  237. ;; * State setting and retrieval see freeglut_state.c
  238. ;; */
  239. (define glutGet (c-lambda ( GLenum ) int "glutGet"))
  240. (define glutDeviceGet (c-lambda ( GLenum ) int "glutDeviceGet"))
  241. (define glutGetModifiers (c-lambda ( ) int "glutGetModifiers"))
  242. (define glutLayerGet (c-lambda ( GLenum ) int "glutLayerGet"))
  243. ;; /*
  244. ;; * Font see freeglut_font.c
  245. ;; */
  246. (define glutBitmapCharacter (c-lambda ( void* int ) void "glutBitmapCharacter"))
  247. (define glutBitmapWidth (c-lambda ( void* int ) int "glutBitmapWidth"))
  248. (define glutStrokeCharacter (c-lambda ( void* int ) void "glutStrokeCharacter"))
  249. (define glutStrokeWidth (c-lambda ( void* int ) int "glutStrokeWidth"))
  250. (define glutBitmapLength (c-lambda ( void* (pointer unsigned-char) ) int "glutBitmapLength"))
  251. (define glutStrokeLength (c-lambda ( void* (pointer unsigned-char) ) int "glutStrokeLength"))
  252. ;; /*
  253. ;; * Geometry see freeglut_geometry.c
  254. ;; */
  255. (define glutWireCube (c-lambda ( GLdouble ) void "glutWireCube"))
  256. (define glutSolidCube (c-lambda ( GLdouble ) void "glutSolidCube"))
  257. (define glutWireSphere (c-lambda ( GLdouble GLint GLint ) void "glutWireSphere"))
  258. (define glutSolidSphere (c-lambda ( GLdouble GLint GLint ) void "glutSolidSphere"))
  259. (define glutWireCone (c-lambda ( GLdouble GLdouble GLint GLint ) void "glutWireCone"))
  260. (define glutSolidCone (c-lambda ( GLdouble GLdouble GLint GLint ) void "glutSolidCone"))
  261. (define glutWireTorus (c-lambda ( GLdouble GLdouble GLint GLint ) void "glutWireTorus"))
  262. (define glutSolidTorus (c-lambda ( GLdouble GLdouble GLint GLint ) void "glutSolidTorus"))
  263. (define glutWireDodecahedron (c-lambda ( ) void "glutWireDodecahedron"))
  264. (define glutSolidDodecahedron (c-lambda ( ) void "glutSolidDodecahedron"))
  265. (define glutWireOctahedron (c-lambda ( ) void "glutWireOctahedron"))
  266. (define glutSolidOctahedron (c-lambda ( ) void "glutSolidOctahedron"))
  267. (define glutWireTetrahedron (c-lambda ( ) void "glutWireTetrahedron"))
  268. (define glutSolidTetrahedron (c-lambda ( ) void "glutSolidTetrahedron"))
  269. (define glutWireIcosahedron (c-lambda ( ) void "glutWireIcosahedron"))
  270. (define glutSolidIcosahedron (c-lambda ( ) void "glutSolidIcosahedron"))
  271. ;; /*
  272. ;; * Teapot rendering found in freeglut_teapot.c
  273. ;; */
  274. (define glutWireTeapot (c-lambda ( GLdouble ) void "glutWireTeapot"))
  275. (define glutSolidTeapot (c-lambda ( GLdouble ) void "glutSolidTeapot"))
  276. ;; /*
  277. ;; * Game mode see freeglut_gamemode.c
  278. ;; */
  279. (define glutGameModeString (c-lambda ( char-string ) void "glutGameModeString"))
  280. (define glutEnterGameMode (c-lambda ( ) int "glutEnterGameMode"))
  281. (define glutLeaveGameMode (c-lambda ( ) void "glutLeaveGameMode"))
  282. (define glutGameModeGet (c-lambda ( GLenum ) int "glutGameModeGet"))
  283. ;; /*
  284. ;; * Video resize see freeglut_videoresize.c
  285. ;; */
  286. (define glutVideoResizeGet (c-lambda ( GLenum ) int "glutVideoResizeGet"))
  287. (define glutSetupVideoResizing (c-lambda ( ) void "glutSetupVideoResizing"))
  288. (define glutStopVideoResizing (c-lambda ( ) void "glutStopVideoResizing"))
  289. (define glutVideoResize (c-lambda ( int int int int ) void "glutVideoResize"))
  290. (define glutVideoPan (c-lambda ( int int int int ) void "glutVideoPan"))
  291. ;; /*
  292. ;; * Colormap see freeglut_misc.c
  293. ;; */
  294. (define glutSetColor (c-lambda ( int GLfloat GLfloat GLfloat ) void "glutSetColor"))
  295. (define glutGetColor (c-lambda ( int int ) GLfloat "glutGetColor"))
  296. (define glutCopyColormap (c-lambda ( int ) void "glutCopyColormap"))
  297. ;; /*
  298. ;; * Misc keyboard and joystick see freeglut_misc.c
  299. ;; */
  300. (define glutIgnoreKeyRepeat (c-lambda ( int ) void "glutIgnoreKeyRepeat"))
  301. (define glutSetKeyRepeat (c-lambda ( int ) void "glutSetKeyRepeat"))
  302. (define glutForceJoystickFunc (c-lambda ( ) void "glutForceJoystickFunc"))
  303. ;; /*
  304. ;; * Misc see freeglut_misc.c
  305. ;; */
  306. (define glutExtensionSupported (c-lambda ( char-string ) int "glutExtensionSupported"))
  307. (define glutReportErrors (c-lambda ( ) void "glutReportErrors"))