1;;;
2;;; glut-lib.stub - glue functions for GLUT
3;;;
4;;;  Copyright (c) 2001-2014  Shiro Kawai  <shiro@acm.org>
5;;;
6;;;  Redistribution and use in source and binary forms, with or without
7;;;  modification, are permitted provided that the following conditions
8;;;  are met:
9;;;
10;;;   1. Redistributions of source code must retain the above copyright
11;;;      notice, this list of conditions and the following disclaimer.
12;;;
13;;;   2. Redistributions in binary form must reproduce the above copyright
14;;;      notice, this list of conditions and the following disclaimer in the
15;;;      documentation and/or other materials provided with the distribution.
16;;;
17;;;   3. Neither the name of the authors nor the names of its contributors
18;;;      may be used to endorse or promote products derived from this
19;;;      software without specific prior written permission.
20;;;
21;;;  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22;;;  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23;;;  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24;;;  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25;;;  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26;;;  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
27;;;  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28;;;  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29;;;  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30;;;  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31;;;  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32;;;
33
34"
35#include \"gauche-gl.h\"
36#ifdef HAVE_GLUT_GLUT_H
37#include <GL/glut.h>
38#else
39#include <GL/glut.h>
40#endif
41#include \"gauche-glut.h\"
42"
43
44(include "glcase.scm")
45
46;;========================================================
47;; Window manipulation
48;;
49
50;; glut-init
51;;   Takes list of args instead of C-style argc/argv, and returns
52;;   (possibly modified) args.
53
54(define-cproc glut-init (args)
55  (let* ([argc::int (Scm_Length args)]
56         [argv::char**])
57    (when (< argc 0) (SCM_TYPE_ERROR args "list"))
58    (set! argv (Scm_ListToCStringArray args TRUE NULL))
59    (glutInit (& argc) argv)
60    (.if "defined(HAVE_GL_GLEW_H)"
61         (let* ([r::GLenum (glewInit)])
62           (unless (!= r GLEW_OK)
63             (Scm_Error "Initializing GLEW failed."))))
64    (result (Scm_CStringArrayToList (cast (const char**) argv) argc 0))))
65
66(define-cproc glut-init-display-mode (mode::<fixnum>)
67  ::<void> glutInitDisplayMode)
68
69(if "!(GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)"
70  "#define glutInitDisplayString(x) /*ignore*/")
71
72(define-cproc glut-init-display-string (string::<const-cstring>)
73  ::<void> glutInitDisplayString)
74
75(define-cproc glut-init-window-size (width::<int> height::<int>)
76  ::<void> glutInitWindowSize)
77
78(define-cproc glut-init-window-position (x::<int> y::<int>)
79  ::<void> glutInitWindowPosition)
80
81(define-cproc glut-main-loop () ::<void> glutMainLoop)
82
83(define-cproc glut-create-window (name::<const-cstring>)
84  ::<int> glutCreateWindow)
85
86(define-cproc glut-create-sub-window (win::<int> x::<int> y::<int>
87                                      width::<int> height::<int>)
88  ::<int> glutCreateSubWindow)
89
90(define-cproc glut-destroy-window (win::<int>)
91  ::<void> glutDestroyWindow)
92
93(define-cproc glut-post-redisplay ()
94  ::<void> glutPostRedisplay)
95
96(if "!(GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)"
97  "#define glutPostWindowRedisplay(win) /*ignore*/")
98
99(define-cproc glut-post-window-redisplay (win::<int>)
100  ::<void> glutPostWindowRedisplay)
101
102(define-cproc glut-swap-buffers () ::<void> glutSwapBuffers)
103
104(define-cproc glut-get-window () ::<int> glutGetWindow)
105
106(define-cproc glut-set-window (win::<int>) ::<void> glutSetWindow)
107
108(define-cproc glut-set-window-title (title::<const-cstring>)
109  ::<void> glutSetWindowTitle)
110
111(define-cproc glut-set-icon-title (title::<const-cstring>)
112  ::<void> glutSetIconTitle)
113
114(define-cproc glut-position-window (x::<int> y::<int>)
115  ::<void> glutPositionWindow)
116
117(define-cproc glut-reshape-window (width::<int> height::<int>)
118  ::<void> glutReshapeWindow)
119
120(define-cproc glut-push-window () ::<void> glutPushWindow)
121(define-cproc glut-pop-window () ::<void> glutPopWindow)
122(define-cproc glut-iconify-window () ::<void> glutIconifyWindow)
123(define-cproc glut-show-window () ::<void> glutShowWindow)
124(define-cproc glut-hide-window () ::<void> glutHideWindow)
125
126(if "!(GLUT_API_VERSION >= 3)"
127  "#define glutFullScreen(x) /*ignore*/")
128
129(define-cproc glut-full-screen () ::<void> glutFullScreen)
130
131(if "!(GLUT_API_VERSION >= 3)"
132  "#define glutSetCursor(x) /*ignore*/")
133
134(define-cproc glut-set-cursor (cursor::<int>) ::<void> glutSetCursor)
135
136(if "!(GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)"
137  "#define glutWarpPointer(x, y) /*ignore*/")
138
139(define-cproc glut-warp-pointer (x::<int> y::<int>) ::<void> glutWarpPointer)
140
141;;========================================================
142;; Overlay APIs
143;;
144
145(define-cproc glut-establish-overlay ()
146  "#if (GLUT_API_VERSION >= 3)
147   glutEstablishOverlay();
148#endif
149   SCM_RETURN(SCM_UNDEFINED);")
150
151(define-cproc glut-remove-overlay ()
152  "#if (GLUT_API_VERSION >= 3)
153   glutRemoveOverlay();
154#endif
155   SCM_RETURN(SCM_UNDEFINED);")
156
157(define-cproc glut-use-layer (layer::<fixnum>)
158  "#if (GLUT_API_VERSION >= 3)
159   glutUseLayer(layer);
160#endif
161   SCM_RETURN(SCM_UNDEFINED);")
162
163(define-cproc glut-post-overlay-redisplay ()
164  "#if (GLUT_API_VERSION >= 3)
165   glutPostOverlayRedisplay();
166#endif
167   SCM_RETURN(SCM_UNDEFINED);")
168
169(define-cproc glut-post-window-overlay-redisplay (win::<int>)
170  "#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)
171   glutPostWindowOverlayRedisplay(win);
172#endif
173   SCM_RETURN(SCM_UNDEFINED);")
174
175(define-cproc glut-show-overlay ()
176  "#if (GLUT_API_VERSION >= 3)
177   glutShowOverlay();
178#endif
179   SCM_RETURN(SCM_UNDEFINED);")
180
181(define-cproc glut-hide-overlay ()
182  "#if (GLUT_API_VERSION >= 3)
183   glutHideOverlay();
184#endif
185   SCM_RETURN(SCM_UNDEFINED);")
186
187;;========================================================
188;; Menu APIs
189;;
190
191;; Glut menu API doesn't passes the callback function which menu
192;; it is invoked.  We need to keep an assoc list of menu id and
193;; callback fn.
194
195"static ScmObj menu_fn_assoc = SCM_NIL;"
196
197(define-cfn menu-callback (item::int) ::void
198  (let* ([menu::int (glutGetMenu)]
199         [p (Scm_Assoc (SCM_MAKE_INT menu) menu_fn_assoc SCM_CMP_EQV)])
200    (when (and (SCM_PAIRP p) (SCM_PROCEDUREP (SCM_CDR p)))
201      (Scm_ApplyRec (SCM_CDR p) (SCM_LIST1 (SCM_MAKE_INT item))))))
202
203(define-cproc glut-create-menu (callback::<procedure>)
204  (let* ([menu::int (glutCreateMenu menu_callback)])
205    (if (>= menu 0)
206      (begin (set! menu_fn_assoc (Scm_Acons (SCM_MAKE_INT menu)
207                                            (SCM_OBJ callback)
208                                            menu_fn_assoc))
209             (result (SCM_MAKE_INT menu)))
210      (result '#f))))
211
212(define-cproc glut-destroy-menu (menu::<fixnum>) ::<void>
213  (set! menu_fn_assoc
214        (Scm_AssocDelete (SCM_MAKE_INT menu) menu_fn_assoc SCM_CMP_EQV))
215  (glutDestroyMenu menu))
216
217(define-cproc glut-get-menu () ::<int> glutGetMenu)
218(define-cproc glut-set-menu (menu::<fixnum>)::<void> glutSetMenu)
219
220(define-cproc glut-add-menu-entry (label::<const-cstring> value::<int>)::<void>
221  glutAddMenuEntry)
222(define-cproc glut-add-sub-menu (label::<const-cstring> submenu::<int>)::<void>
223  glutAddSubMenu)
224(define-cproc glut-change-to-menu-entry (item::<int> label::<const-cstring>
225                                         value::<int>)
226  ::<void> glutChangeToMenuEntry)
227(define-cproc glut-change-to-sub-menu (item::<int> label::<const-cstring>
228                                       submenu::<int>)
229  ::<void> glutChangeToSubMenu)
230
231(define-cproc glut-remove-menu-item (item::<int>) ::<void> glutRemoveMenuItem)
232(define-cproc glut-attach-menu (button::<int>) ::<void> glutAttachMenu)
233(define-cproc glut-detach-menu (button::<int>) ::<void> glutDetachMenu)
234
235;;========================================================
236;; Callbacks
237;;
238
239;; Most Glut callbacks are associated to the "current window".
240;; Scm_GlutRegisterCallback handles the association.
241
242(define-cproc glut-display-func (fn) ::<void>
243  (Scm_GlutRegisterCallback SCM_GLUT_CB_DISPLAY fn 0 0))
244(define-cproc glut-overlay-display-func (fn) ::<void>
245  (Scm_GlutRegisterCallback SCM_GLUT_CB_OVERLAY_DISPLAY fn 0 0))
246(define-cproc glut-reshape-func (fn) ::<void>
247  (Scm_GlutRegisterCallback SCM_GLUT_CB_RESHAPE fn 0 0))
248(define-cproc glut-keyboard-func (fn) ::<void>
249  (Scm_GlutRegisterCallback SCM_GLUT_CB_KEYBOARD fn 0 0))
250(define-cproc glut-keyboard-up-func (fn) ::<void>
251  (Scm_GlutRegisterCallback SCM_GLUT_CB_KEYBOARD_UP fn 0 0))
252(define-cproc glut-mouse-func (fn) ::<void>
253  (Scm_GlutRegisterCallback SCM_GLUT_CB_MOUSE fn 0 0))
254(define-cproc glut-motion-func (fn) ::<void>
255  (Scm_GlutRegisterCallback SCM_GLUT_CB_MOTION fn 0 0))
256(define-cproc glut-passive-motion-func (fn) ::<void>
257  (Scm_GlutRegisterCallback SCM_GLUT_CB_PASSIVE_MOTION fn 0 0))
258(define-cproc glut-visibility-func (fn) ::<void>
259  (Scm_GlutRegisterCallback SCM_GLUT_CB_VISIBILITY fn 0 0))
260(define-cproc glut-entry-func (fn) ::<void>
261  (Scm_GlutRegisterCallback SCM_GLUT_CB_ENTRY fn 0 0))
262(define-cproc glut-special-func (fn) ::<void>
263  (Scm_GlutRegisterCallback SCM_GLUT_CB_SPECIAL fn 0 0))
264(define-cproc glut-special-up-func (fn) ::<void>
265  (Scm_GlutRegisterCallback SCM_GLUT_CB_SPECIAL_UP fn 0 0))
266(define-cproc glut-spaceball-motion-func (fn) ::<void>
267  (Scm_GlutRegisterCallback SCM_GLUT_CB_SPACEBALL_MOTION fn 0 0))
268(define-cproc glut-spaceball-rotate-func (fn) ::<void>
269  (Scm_GlutRegisterCallback SCM_GLUT_CB_SPACEBALL_ROTATE fn 0 0))
270(define-cproc glut-spaceball-button-func (fn) ::<void>
271  (Scm_GlutRegisterCallback SCM_GLUT_CB_SPACEBALL_BUTTON fn 0 0))
272(define-cproc glut-button-box-func (fn) ::<void>
273  (Scm_GlutRegisterCallback SCM_GLUT_CB_BUTTON_BOX fn 0 0))
274(define-cproc glut-dials (fn) ::<void>
275  (Scm_GlutRegisterCallback SCM_GLUT_CB_DIALS fn 0 0))
276(define-cproc glut-tablet-motion-func (fn) ::<void>
277  (Scm_GlutRegisterCallback SCM_GLUT_CB_TABLET_MOTION fn 0 0))
278(define-cproc glut-tablet-button-func (fn) ::<void>
279  (Scm_GlutRegisterCallback SCM_GLUT_CB_TABLET_BUTTON fn 0 0))
280(define-cproc glut-menu-status (fn) ::<void>
281  (Scm_GlutRegisterCallback SCM_GLUT_CB_MENU_STATUS fn 0 0))
282(define-cproc glut-window-status (fn) ::<void>
283  (Scm_GlutRegisterCallback SCM_GLUT_CB_WINDOW_STATUS fn 0 0))
284(define-cproc glut-joystick-func (fn interval::<int>) ::<void>
285  (Scm_GlutRegisterCallback SCM_GLUT_CB_JOYSTICK fn interval 0))
286
287
288(define-cproc glut-idle-func (fn) ::<void>
289  (Scm_GlutRegisterCallback SCM_GLUT_CB_IDLE fn 0 0))
290(define-cproc glut-timer-func (millis::<int> fn value::<int>) ::<void>
291  (Scm_GlutRegisterCallback SCM_GLUT_CB_TIMER fn millis value))
292
293
294;;========================================================
295;; Colormap
296;;
297
298(define-cproc glut-set-color (index::<int> r::<float> g::<float> b::<float>)
299  ::<void> glutSetColor)
300
301(define-cproc glut-get-color (index::<int> component::<fixnum>)
302  ::<double> (result (cast double (glutGetColor index component))))
303
304(define-cproc glut-copy-colormap (win::<int>) ::<void> glutCopyColormap)
305
306;;========================================================
307;; state retrieval
308;;
309
310(define-cproc glut-get (type::<int>) ::<int> glutGet)
311
312(define-cproc glut-device-get (type::<int>) ::<int> glutDeviceGet)
313
314(if "!(GLUT_API_VERSION >= 2)"
315  "#define glutExtensionSupported(x) FALSE")
316
317(define-cproc glut-extension-supported (name::<const-cstring>) ::<boolean>
318  glutExtensionSupported)
319
320(if "!(GLUT_API_VERSION >= 3)"
321  "#define glutGetModifiers() 0")
322
323(define-cproc glut-get-modifiers () ::<int> glutGetModifiers)
324
325(if "!(GLUT_API_VERSION >= 3)"
326  "#define glutLayerGet(x) 0")
327
328(define-cproc glut-layer-get (type::<int>) ::<int> glutLayerGet)
329
330;;========================================================
331;; Font
332;;
333
334(define-type <glut-font> "ScmGlutFont*" #f
335  "SCM_GLUT_FONT_P" "SCM_GLUT_FONT")
336
337(define-cproc glut-bitmap-character (font::<glut-font> character::<int>)
338  ::<void> (glutBitmapCharacter (-> font font) character))
339
340(define-cproc glut-bitmap-width (font::<glut-font> character::<int>) ::<int>
341  (result (glutBitmapWidth (-> font font) character)))
342
343(define-cproc glut-stroke-character (font::<glut-font> character::<int>)
344  ::<void> (glutStrokeCharacter (-> font font) character))
345
346(define-cproc glut-stroke-width (font::<glut-font> character::<int>)
347  ::<int> (result (glutStrokeWidth (-> font font) character)))
348
349(if "!(GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)"
350  "#define glutBitmapLength(x, y) 0")
351
352(define-cproc glut-bitmap-length (font::<glut-font> string::<const-cstring>)
353  ::<int> (result (glutBitmapLength (-> font font)
354                                    (cast (const unsigned char*) string))))
355
356(if "!(GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)"
357  "#define glutStrokeLength(x, y) 0")
358
359(define-cproc glut-stroke-length (font::<glut-font> string::<const-cstring>)
360  ::<int> (result (glutStrokeLength (-> font font)
361                                    (cast (const unsigned char*) string))))
362
363;;========================================================
364;; pre-built models
365;;
366
367(define-cproc glut-wire-sphere (radius::<real> slices::<int> stacks::<int>)
368  ::<void> glutWireSphere)
369(define-cproc glut-solid-sphere (radius::<real> slices::<int> stacks::<int>)
370  ::<void> glutSolidSphere)
371
372(define-cproc glut-wire-cone (radius::<real> height::<real>
373                              slices::<int> stacks::<int>)
374  ::<void> glutWireCone)
375(define-cproc glut-solid-cone (radius::<real> height::<real>
376                               slices::<int> stacks::<int>)
377  ::<void> glutSolidCone)
378
379(define-cproc glut-wire-cube (size::<real>) ::<void> glutWireCube)
380(define-cproc glut-solid-cube (size::<real>) ::<void> glutSolidCube)
381
382(define-cproc glut-wire-torus (inner::<real> outer::<real>
383                               sides::<int> rings::<int>)
384  ::<void> glutWireTorus)
385(define-cproc glut-solid-torus (inner::<real> outer::<real>
386                                sides::<int> rings::<int>)
387  ::<void> glutSolidTorus)
388
389(define-cproc glut-wire-dodecahedron () ::<void> glutWireDodecahedron)
390(define-cproc glut-solid-dodecahedron () ::<void> glutSolidDodecahedron)
391
392(define-cproc glut-wire-teapot (size::<real>) ::<void> glutWireTeapot)
393(define-cproc glut-solid-teapot (size::<real>) ::<void> glutSolidTeapot)
394
395(define-cproc glut-wire-octahedron () ::<void> glutWireOctahedron)
396(define-cproc glut-solid-octahedron () ::<void> glutSolidOctahedron)
397
398(define-cproc glut-wire-tetrahedron () ::<void> glutWireTetrahedron)
399(define-cproc glut-solid-tetrahedron () ::<void> glutSolidTetrahedron)
400
401(define-cproc glut-wire-icosahedron () ::<void> glutWireIcosahedron)
402(define-cproc glut-solid-icosahedron () ::<void> glutSolidIcosahedron)
403
404;;========================================================
405;; Video resize
406;;
407
408;;========================================================
409;; Debug
410;;
411
412;;========================================================
413;; Device control
414;;
415
416;;========================================================
417;; Constants
418;;
419
420;; Display mode bit masks
421(define-enum GLUT_RGB)
422(define-enum GLUT_RGBA)
423(define-enum GLUT_INDEX)
424(define-enum GLUT_SINGLE)
425(define-enum GLUT_DOUBLE)
426(define-enum GLUT_ACCUM)
427(define-enum GLUT_ALPHA)
428(define-enum GLUT_DEPTH)
429(define-enum GLUT_STENCIL)
430(if "(GLUT_API_VERSION >= 2)"
431    (begin
432      (define-enum GLUT_MULTISAMPLE)
433      (define-enum GLUT_STEREO)
434      ))
435(if "(GLUT_API_VERSION >= 3)"
436    (define-enum GLUT_LUMINANCE))
437
438;; Mouse
439(define-enum GLUT_LEFT_BUTTON)
440(define-enum GLUT_MIDDLE_BUTTON)
441(define-enum GLUT_RIGHT_BUTTON)
442(define-enum GLUT_DOWN)
443(define-enum GLUT_UP)
444
445;; Function Keys
446(if "(GLUT_API_VERSION >= 2)"
447    (begin
448      (define-enum GLUT_KEY_F1)
449      (define-enum GLUT_KEY_F2)
450      (define-enum GLUT_KEY_F3)
451      (define-enum GLUT_KEY_F4)
452      (define-enum GLUT_KEY_F5)
453      (define-enum GLUT_KEY_F6)
454      (define-enum GLUT_KEY_F7)
455      (define-enum GLUT_KEY_F8)
456      (define-enum GLUT_KEY_F9)
457      (define-enum GLUT_KEY_F10)
458      (define-enum GLUT_KEY_F11)
459      (define-enum GLUT_KEY_F12)
460      (define-enum GLUT_KEY_LEFT)
461      (define-enum GLUT_KEY_UP)
462      (define-enum GLUT_KEY_RIGHT)
463      (define-enum GLUT_KEY_DOWN)
464      (define-enum GLUT_KEY_PAGE_UP)
465      (define-enum GLUT_KEY_PAGE_DOWN)
466      (define-enum GLUT_KEY_HOME)
467      (define-enum GLUT_KEY_END)
468      (define-enum GLUT_KEY_INSERT)
469      ))
470
471;; Entry/exit  state.
472(define-enum GLUT_LEFT)
473(define-enum GLUT_ENTERED)
474
475;; Menu usage  state.
476(define-enum GLUT_MENU_NOT_IN_USE)
477(define-enum GLUT_MENU_IN_USE)
478
479;; Visibility  state.
480(define-enum GLUT_NOT_VISIBLE)
481(define-enum GLUT_VISIBLE)
482
483;; Window status  state.
484(define-enum GLUT_HIDDEN)
485(define-enum GLUT_FULLY_RETAINED)
486(define-enum GLUT_PARTIALLY_RETAINED)
487(define-enum GLUT_FULLY_COVERED)
488
489;; Color index component selection values
490(define-enum GLUT_RED)
491(define-enum GLUT_GREEN)
492(define-enum GLUT_BLUE)
493
494;; Layers for use
495(define-enum GLUT_NORMAL)
496(define-enum GLUT_OVERLAY)
497
498;; glutGet parameters
499(define-enum GLUT_WINDOW_X)
500(define-enum GLUT_WINDOW_Y)
501(define-enum GLUT_WINDOW_WIDTH)
502(define-enum GLUT_WINDOW_HEIGHT)
503(define-enum GLUT_WINDOW_BUFFER_SIZE)
504(define-enum GLUT_WINDOW_STENCIL_SIZE)
505(define-enum GLUT_WINDOW_DEPTH_SIZE)
506(define-enum GLUT_WINDOW_RED_SIZE)
507(define-enum GLUT_WINDOW_GREEN_SIZE)
508(define-enum GLUT_WINDOW_BLUE_SIZE)
509(define-enum GLUT_WINDOW_ALPHA_SIZE)
510(define-enum GLUT_WINDOW_ACCUM_RED_SIZE)
511(define-enum GLUT_WINDOW_ACCUM_GREEN_SIZE)
512(define-enum GLUT_WINDOW_ACCUM_BLUE_SIZE)
513(define-enum GLUT_WINDOW_ACCUM_ALPHA_SIZE)
514(define-enum GLUT_WINDOW_DOUBLEBUFFER)
515(define-enum GLUT_WINDOW_RGBA)
516(define-enum GLUT_WINDOW_PARENT)
517(define-enum GLUT_WINDOW_NUM_CHILDREN)
518(define-enum GLUT_WINDOW_COLORMAP_SIZE)
519(if "(GLUT_API_VERSION >= 2)"
520    (begin
521      (define-enum GLUT_WINDOW_NUM_SAMPLES)
522      (define-enum GLUT_WINDOW_STEREO)
523      ))
524(if "(GLUT_API_VERSION >= 3)"
525    (begin
526      (define-enum GLUT_WINDOW_CURSOR)
527      ))
528(define-enum GLUT_SCREEN_WIDTH)
529(define-enum GLUT_SCREEN_HEIGHT)
530(define-enum GLUT_SCREEN_WIDTH_MM)
531(define-enum GLUT_SCREEN_HEIGHT_MM)
532(define-enum GLUT_MENU_NUM_ITEMS)
533(define-enum GLUT_DISPLAY_MODE_POSSIBLE)
534(define-enum GLUT_INIT_WINDOW_X)
535(define-enum GLUT_INIT_WINDOW_Y)
536(define-enum GLUT_INIT_WINDOW_WIDTH)
537(define-enum GLUT_INIT_WINDOW_HEIGHT)
538(define-enum GLUT_INIT_DISPLAY_MODE)
539(if "(GLUT_API_VERSION >= 2)"
540    (define-enum GLUT_ELAPSED_TIME)
541    )
542(if "(GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)"
543    (define-enum GLUT_WINDOW_FORMAT_ID)
544    )
545
546;; glutDeviceGet parameters
547(if "(GLUT_API_VERSION >= 2)"
548    (begin
549      (define-enum GLUT_HAS_KEYBOARD)
550      (define-enum GLUT_HAS_MOUSE)
551      (define-enum GLUT_HAS_SPACEBALL)
552      (define-enum GLUT_HAS_DIAL_AND_BUTTON_BOX)
553      (define-enum GLUT_HAS_TABLET)
554      (define-enum GLUT_NUM_MOUSE_BUTTONS)
555      (define-enum GLUT_NUM_SPACEBALL_BUTTONS)
556      (define-enum GLUT_NUM_BUTTON_BOX_BUTTONS)
557      (define-enum GLUT_NUM_DIALS)
558      (define-enum GLUT_NUM_TABLET_BUTTONS)
559      ))
560(if "(GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)"
561    (begin
562      (define-enum GLUT_DEVICE_IGNORE_KEY_REPEAT)
563      (define-enum GLUT_DEVICE_KEY_REPEAT)
564      (define-enum GLUT_HAS_JOYSTICK)
565      (define-enum GLUT_OWNS_JOYSTICK)
566      (define-enum GLUT_JOYSTICK_BUTTONS)
567      (define-enum GLUT_JOYSTICK_AXES)
568      (define-enum GLUT_JOYSTICK_POLL_RATE)
569      ))
570
571;; glutLayerGet parameters.
572(if "(GLUT_API_VERSION >= 3)"
573    (begin
574      (define-enum GLUT_OVERLAY_POSSIBLE)
575      (define-enum GLUT_LAYER_IN_USE)
576      (define-enum GLUT_HAS_OVERLAY)
577      (define-enum GLUT_TRANSPARENT_INDEX)
578      (define-enum GLUT_NORMAL_DAMAGED)
579      (define-enum GLUT_OVERLAY_DAMAGED)
580      ))
581
582;; glutVideoResizeGet parameters
583(if "(GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)"
584    (begin
585      (define-enum GLUT_VIDEO_RESIZE_POSSIBLE)
586      (define-enum GLUT_VIDEO_RESIZE_IN_USE)
587      (define-enum GLUT_VIDEO_RESIZE_X_DELTA)
588      (define-enum GLUT_VIDEO_RESIZE_Y_DELTA)
589      (define-enum GLUT_VIDEO_RESIZE_WIDTH_DELTA)
590      (define-enum GLUT_VIDEO_RESIZE_HEIGHT_DELTA)
591      (define-enum GLUT_VIDEO_RESIZE_X)
592      (define-enum GLUT_VIDEO_RESIZE_Y)
593      (define-enum GLUT_VIDEO_RESIZE_WIDTH)
594      (define-enum GLUT_VIDEO_RESIZE_HEIGHT)
595      ))
596
597;; glutGetModifiers return mask
598(if "(GLUT_API_VERSION >= 3)"
599    (begin
600      (define-enum GLUT_ACTIVE_SHIFT)
601      (define-enum GLUT_ACTIVE_CTRL)
602      (define-enum GLUT_ACTIVE_ALT)
603      ))
604
605;; glutSetCursor parameters
606(if "(GLUT_API_VERSION >= 3)"
607    (begin
608      ;;  Basic arrows
609      (define-enum GLUT_CURSOR_RIGHT_ARROW)
610      (define-enum GLUT_CURSOR_LEFT_ARROW)
611      ;;  Symbolic cursor shapes
612      (define-enum GLUT_CURSOR_INFO)
613      (define-enum GLUT_CURSOR_DESTROY)
614      (define-enum GLUT_CURSOR_HELP)
615      (define-enum GLUT_CURSOR_CYCLE)
616      (define-enum GLUT_CURSOR_SPRAY)
617      (define-enum GLUT_CURSOR_WAIT)
618      (define-enum GLUT_CURSOR_TEXT)
619      (define-enum GLUT_CURSOR_CROSSHAIR)
620      ;;   Directional cursors
621      (define-enum GLUT_CURSOR_UP_DOWN)
622      (define-enum GLUT_CURSOR_LEFT_RIGHT)
623      ;;   Sizing cursors
624      (define-enum GLUT_CURSOR_TOP_SIDE)
625      (define-enum GLUT_CURSOR_BOTTOM_SIDE)
626      (define-enum GLUT_CURSOR_LEFT_SIDE)
627      (define-enum GLUT_CURSOR_RIGHT_SIDE)
628      (define-enum GLUT_CURSOR_TOP_LEFT_CORNER)
629      (define-enum GLUT_CURSOR_TOP_RIGHT_CORNER)
630      (define-enum GLUT_CURSOR_BOTTOM_RIGHT_CORNER)
631      (define-enum GLUT_CURSOR_BOTTOM_LEFT_CORNER)
632      ;;   Inherit from parent window
633      (define-enum GLUT_CURSOR_INHERIT)
634      ;;   Blank cursor
635      (define-enum GLUT_CURSOR_NONE)
636      ;;   Fullscreen crosshair (if available)
637      (define-enum GLUT_CURSOR_FULL_CROSSHAIR)
638      ))
639
640;; Local variables:
641;; mode: scheme
642;; end:
643