glut2 8.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ext/glut/glut.c ADDED
@@ -0,0 +1,1152 @@
1
+ /*
2
+ * Last edit by previous maintainer:
3
+ * 2004/03/02 01:13:06, yoshi
4
+ *
5
+ * Copyright (C) 1999 - 2005 Yoshi <yoshi@giganet.net>
6
+ * Copyright (C) 2005 James Adam <james@lazyatom.com>
7
+ * Copyright (C) 2006 John M. Gabriele <jmg3000@gmail.com>
8
+ * Copyright (C) 2007 Jan Dvorak <jan.dvorak@kraxnet.cz>
9
+ *
10
+ * This program is distributed under the terms of the MIT license.
11
+ * See the included COPYRIGHT file for the terms of this license.
12
+ *
13
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
17
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
18
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
19
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ *
21
+ */
22
+
23
+ #include "common.h"
24
+ extern void *rb_thread_call_without_gvl(void *(*func)(void *), void *data1,
25
+ rb_unblock_function_t *ubf, void *data2);
26
+
27
+ static VALUE menu_callback = Qnil;
28
+ static ID call_id; /* 'call' method id */
29
+
30
+ VALUE
31
+ rb_glut_check_callback(VALUE self, VALUE callback)
32
+ {
33
+ VALUE inspect;
34
+
35
+ if (NIL_P(callback))
36
+ return callback;
37
+
38
+ if (rb_respond_to(callback, call_id))
39
+ return callback;
40
+
41
+ if (SYMBOL_P(callback))
42
+ return rb_obj_method(self, callback);
43
+
44
+ inspect = rb_inspect(callback);
45
+ rb_raise(rb_eArgError, "%s must respond to call", StringValueCStr(inspect));
46
+ }
47
+
48
+ static VALUE glut_Init( int argc, VALUE * argv, VALUE obj)
49
+ {
50
+ int largc;
51
+ char** largv;
52
+ VALUE new_argv;
53
+ VALUE orig_arg;
54
+ int i;
55
+
56
+ if (rb_scan_args(argc, argv, "01", &orig_arg) == 0)
57
+ orig_arg = rb_eval_string("[$0] + ARGV");
58
+ else
59
+ Check_Type(orig_arg, T_ARRAY);
60
+
61
+ /* converts commandline parameters from ruby to C, passes them
62
+ to glutInit and returns the parameters stripped of glut-specific
63
+ commands ("-display","-geometry" etc.) */
64
+ largc = (int)RARRAY_LENINT(orig_arg);
65
+ largv = ALLOCA_N(char*, largc);
66
+ for (i = 0; i < largc; i++)
67
+ largv[i] = StringValueCStr(RARRAY_PTR(orig_arg)[i]);
68
+
69
+ glutInit(&largc, largv);
70
+
71
+ new_argv = rb_ary_new2(largc);
72
+ for (i = 0; i < largc; i++)
73
+ rb_ary_push(new_argv,rb_str_new2(largv[i]));
74
+
75
+ rb_ary_shift(new_argv);
76
+
77
+ return new_argv;
78
+ }
79
+
80
+ static VALUE glut_InitDisplayMode(obj,arg1)
81
+ VALUE obj,arg1;
82
+ {
83
+ unsigned int mode;
84
+ mode = (unsigned int)NUM2INT(arg1);
85
+ glutInitDisplayMode(mode);
86
+ return Qnil;
87
+ }
88
+
89
+ static VALUE
90
+ glut_InitDisplayString(obj,arg1)
91
+ VALUE obj,arg1;
92
+ {
93
+ Check_Type(arg1,T_STRING);
94
+ glutInitDisplayString(RSTRING_PTR(arg1));
95
+ return Qnil;
96
+ }
97
+
98
+ static VALUE
99
+ glut_InitWindowPosition(obj,arg1,arg2)
100
+ VALUE obj,arg1,arg2;
101
+ {
102
+ int x,y;
103
+ x = NUM2INT(arg1);
104
+ y = NUM2INT(arg2);
105
+ glutInitWindowPosition(x,y);
106
+ return Qnil;
107
+ }
108
+
109
+ static VALUE
110
+ glut_InitWindowSize(obj, arg1, arg2)
111
+ VALUE obj,arg1,arg2;
112
+ {
113
+ int width,height;
114
+ width = NUM2INT(arg1);
115
+ height = NUM2INT(arg2);
116
+ glutInitWindowSize(width,height);
117
+ return Qnil;
118
+ }
119
+
120
+ void *glut_MainLoop0(void *ignored) {
121
+ glutMainLoop();
122
+
123
+ return NULL; /* never reached */
124
+ }
125
+
126
+ static VALUE
127
+ glut_MainLoop(self) VALUE self; {
128
+ rb_thread_call_without_gvl(glut_MainLoop0, NULL, NULL, NULL);
129
+
130
+ return Qnil; /* never reached */
131
+ }
132
+
133
+ static VALUE
134
+ glut_CheckLoop(self) VALUE self; {
135
+ rb_warn("calling fake CheckLoop implementation which never returns");
136
+
137
+ glut_MainLoop();
138
+
139
+ return Qnil;
140
+ }
141
+
142
+ /* GLUT window sub-API. */
143
+ static VALUE glut_CreateWindow(argc, argv, obj)
144
+ int argc;
145
+ VALUE* argv;
146
+ VALUE obj;
147
+ {
148
+ int ret;
149
+ VALUE title;
150
+ rb_scan_args(argc, argv, "01", &title);
151
+ if (argc == 0)
152
+ title = rb_eval_string("$0");
153
+ Check_Type(title,T_STRING);
154
+ ret = glutCreateWindow(RSTRING_PTR(title));
155
+ return INT2NUM(ret);
156
+ }
157
+
158
+ static VALUE
159
+ glut_CreateSubWindow(obj,arg1,arg2,arg3,arg4,arg5)
160
+ VALUE obj,arg1,arg2,arg3,arg4,arg5;
161
+ {
162
+ int win, x, y, width, height;
163
+ int ret;
164
+ win = NUM2INT(arg1);
165
+ x = NUM2INT(arg2);
166
+ y = NUM2INT(arg3);
167
+ width = NUM2INT(arg4);
168
+ height = NUM2INT(arg5);
169
+ ret = glutCreateSubWindow(win, x, y, width, height);
170
+ return INT2NUM(ret);
171
+ }
172
+
173
+ static VALUE
174
+ glut_DestroyWindow(obj,arg1)
175
+ VALUE obj,arg1;
176
+ {
177
+ int win;
178
+ win = NUM2INT(arg1);
179
+ glutDestroyWindow(win);
180
+ return Qnil;
181
+ }
182
+
183
+ GLUT_SIMPLE_FUNCTION(PostRedisplay)
184
+ GLUT_SIMPLE_FUNCTION(SwapBuffers)
185
+
186
+ static VALUE
187
+ glut_GetWindow(obj)
188
+ VALUE obj;
189
+ {
190
+ int ret;
191
+ ret = glutGetWindow();
192
+ return INT2NUM(ret);
193
+ }
194
+
195
+ static VALUE
196
+ glut_SetWindow(obj,arg1)
197
+ VALUE obj,arg1;
198
+ {
199
+ int win;
200
+ win = NUM2INT(arg1);
201
+ glutSetWindow(win);
202
+ return Qnil;
203
+ }
204
+
205
+ static VALUE
206
+ glut_SetWindowTitle(obj,arg1)
207
+ VALUE obj,arg1;
208
+ {
209
+ Check_Type(arg1,T_STRING);
210
+ glutSetWindowTitle(RSTRING_PTR(arg1));
211
+ return Qnil;
212
+ }
213
+
214
+ static VALUE
215
+ glut_SetIconTitle(obj, arg1)
216
+ VALUE obj,arg1;
217
+ {
218
+ Check_Type(arg1,T_STRING);
219
+ glutSetIconTitle(RSTRING_PTR(arg1));
220
+ return Qnil;
221
+ }
222
+
223
+ static VALUE
224
+ glut_PositionWindow(obj,arg1,arg2)
225
+ VALUE obj,arg1,arg2;
226
+ {
227
+ int x,y;
228
+ x = NUM2INT(arg1);
229
+ y = NUM2INT(arg2);
230
+ glutPositionWindow(x,y);
231
+ return Qnil;
232
+ }
233
+
234
+ static VALUE
235
+ glut_ReshapeWindow(obj,arg1,arg2)
236
+ VALUE obj,arg1,arg2;
237
+ {
238
+ int width,height;
239
+ width = NUM2INT(arg1);
240
+ height = NUM2INT(arg2);
241
+ glutReshapeWindow(width, height);
242
+ return Qnil;
243
+ }
244
+
245
+ GLUT_SIMPLE_FUNCTION(PopWindow)
246
+ GLUT_SIMPLE_FUNCTION(PushWindow)
247
+ GLUT_SIMPLE_FUNCTION(IconifyWindow)
248
+ GLUT_SIMPLE_FUNCTION(ShowWindow)
249
+ GLUT_SIMPLE_FUNCTION(HideWindow)
250
+ GLUT_SIMPLE_FUNCTION(FullScreen)
251
+
252
+ static VALUE
253
+ glut_SetCursor(obj,arg1)
254
+ VALUE obj,arg1;
255
+ {
256
+ int cursor;
257
+ cursor = NUM2INT(arg1);
258
+ glutSetCursor(cursor);
259
+ return Qnil;
260
+ }
261
+
262
+ static VALUE
263
+ glut_WarpPointer(obj,arg1,arg2)
264
+ VALUE obj,arg1,arg2;
265
+ {
266
+ int x,y;
267
+ x = NUM2INT(arg1);
268
+ y = NUM2INT(arg2);
269
+ glutWarpPointer(x,y);
270
+ return Qnil;
271
+ }
272
+
273
+ /* GLUT overlay sub-API. */
274
+ GLUT_SIMPLE_FUNCTION(EstablishOverlay)
275
+ GLUT_SIMPLE_FUNCTION(RemoveOverlay)
276
+ GLUT_SIMPLE_FUNCTION(PostOverlayRedisplay)
277
+ GLUT_SIMPLE_FUNCTION(ShowOverlay)
278
+ GLUT_SIMPLE_FUNCTION(HideOverlay)
279
+
280
+ static VALUE
281
+ glut_UseLayer(obj,arg1)
282
+ VALUE obj, arg1;
283
+ {
284
+ GLenum layer;
285
+ layer = (GLenum)NUM2INT(arg1);
286
+ glutUseLayer(layer);
287
+ return Qnil;
288
+ }
289
+
290
+ static void GLUTCALLBACK
291
+ glut_CreateMenuCallback(int value)
292
+ {
293
+ VALUE func;
294
+ int menu;
295
+ menu = glutGetMenu();
296
+ func = rb_ary_entry(menu_callback, menu);
297
+
298
+ rb_funcall(func, call_id, 1, INT2NUM(value));
299
+ }
300
+
301
+ static VALUE
302
+ glut_CreateMenu(VALUE obj, VALUE callback) {
303
+ int menu;
304
+
305
+ callback = rb_glut_check_callback(obj, callback);
306
+
307
+ if (NIL_P(callback))
308
+ menu = glutCreateMenu(NULL);
309
+ else
310
+ menu = glutCreateMenu(glut_CreateMenuCallback);
311
+
312
+ rb_ary_store(menu_callback, menu, callback);
313
+
314
+ return INT2FIX(menu);
315
+ }
316
+
317
+ static VALUE
318
+ glut_DestroyMenu(obj,arg1)
319
+ VALUE obj,arg1;
320
+ {
321
+ int menu;
322
+ menu = NUM2INT(arg1);
323
+ glutDestroyMenu(menu);
324
+ //rb_hash_aset(g_menucallback, menu, Qnil);
325
+ //rb_hash_aset(g_menuargs, menu, Qnil);
326
+ return Qnil;
327
+ }
328
+
329
+ static VALUE
330
+ glut_GetMenu(obj)
331
+ VALUE obj;
332
+ {
333
+ int ret;
334
+ ret = glutGetMenu();
335
+ return INT2NUM(ret);
336
+ }
337
+
338
+ static VALUE
339
+ glut_SetMenu(obj,arg1)
340
+ VALUE obj,arg1;
341
+ {
342
+ glutSetMenu(NUM2INT(arg1));
343
+ return Qnil;
344
+ }
345
+
346
+ static VALUE
347
+ glut_AddMenuEntry(obj,arg1,arg2)
348
+ VALUE obj,arg1,arg2;
349
+ {
350
+ Check_Type(arg1,T_STRING);
351
+ glutAddMenuEntry(RSTRING_PTR(arg1), NUM2INT(arg2));
352
+ return Qnil;
353
+ }
354
+
355
+ static VALUE
356
+ glut_AddSubMenu(obj,arg1,arg2)
357
+ VALUE obj,arg1,arg2;
358
+ {
359
+ Check_Type(arg1,T_STRING);
360
+ glutAddSubMenu(RSTRING_PTR(arg1), NUM2INT(arg2));
361
+ return Qnil;
362
+ }
363
+
364
+ static VALUE glut_ChangeToMenuEntry(obj,arg1,arg2,arg3)
365
+ VALUE obj,arg1,arg2,arg3;
366
+ {
367
+ Check_Type(arg2,T_STRING);
368
+ glutChangeToMenuEntry(NUM2INT(arg1), RSTRING_PTR(arg2), NUM2INT(arg3));
369
+ return Qnil;
370
+ }
371
+
372
+ static VALUE glut_ChangeToSubMenu(obj,arg1,arg2,arg3)
373
+ VALUE obj,arg1,arg2,arg3;
374
+ {
375
+ Check_Type(arg2,T_STRING);
376
+ glutChangeToSubMenu(NUM2INT(arg1), RSTRING_PTR(arg2), NUM2INT(arg3));
377
+ return Qnil;
378
+ }
379
+
380
+ static VALUE glut_RemoveMenuItem( VALUE obj, VALUE arg1 )
381
+ {
382
+ glutRemoveMenuItem(NUM2INT(arg1));
383
+ return Qnil;
384
+ }
385
+
386
+ static VALUE
387
+ glut_AttachMenu(obj,arg1)
388
+ VALUE obj, arg1;
389
+ {
390
+ glutAttachMenu(NUM2INT(arg1));
391
+ return Qnil;
392
+ }
393
+
394
+ static VALUE
395
+ glut_DetachMenu(obj,arg1)
396
+ VALUE obj, arg1;
397
+ {
398
+ glutDetachMenu(NUM2INT(arg1));
399
+ return Qnil;
400
+ }
401
+
402
+ /* GLUT color index sub-API. */
403
+ static VALUE
404
+ glut_SetColor(obj,arg1,arg2,arg3,arg4)
405
+ VALUE obj,arg1,arg2,arg3,arg4;
406
+ {
407
+ int set;
408
+ GLfloat red;
409
+ GLfloat green;
410
+ GLfloat blue;
411
+ set = NUM2INT(arg1);
412
+ red = (GLfloat)NUM2DBL(arg2);
413
+ green = (GLfloat)NUM2DBL(arg3);
414
+ blue = (GLfloat)NUM2DBL(arg4);
415
+ glutSetColor(set, red, green, blue);
416
+ return Qnil;
417
+ }
418
+
419
+ static VALUE
420
+ glut_GetColor(obj,arg1,arg2)
421
+ VALUE obj,arg1,arg2;
422
+ {
423
+ int ndx;
424
+ int component;
425
+ GLfloat ret;
426
+ ndx = NUM2INT(arg1);
427
+ component = NUM2INT(arg2);
428
+ ret = (GLfloat)glutGetColor(ndx, component);
429
+ return rb_float_new(ret);
430
+ }
431
+
432
+ static VALUE
433
+ glut_CopyColormap(obj,arg1)
434
+ VALUE obj,arg1;
435
+ {
436
+ int win;
437
+ win = NUM2INT(arg1);
438
+ glutCopyColormap(win);
439
+ return Qnil;
440
+ }
441
+
442
+ /* GLUT state retrieval sub-API. */
443
+ static VALUE
444
+ glut_Get(obj,arg1)
445
+ VALUE obj,arg1;
446
+ {
447
+ GLenum type;
448
+ int ret;
449
+ type = (GLenum)NUM2INT(arg1);
450
+ ret = glutGet(type);
451
+ return INT2NUM(ret);
452
+ }
453
+
454
+ static VALUE
455
+ glut_DeviceGet(obj,arg1)
456
+ VALUE obj,arg1;
457
+ {
458
+ GLenum type;
459
+ int ret;
460
+ type = (GLenum)NUM2INT(arg1);
461
+ ret = glutDeviceGet(type);
462
+ return INT2NUM(ret);
463
+ }
464
+
465
+ /* GLUT extension support sub-API */
466
+ static VALUE
467
+ glut_ExtensionSupported(obj,arg1)
468
+ VALUE obj,arg1;
469
+ {
470
+ int ret;
471
+ Check_Type(arg1,T_STRING);
472
+ ret = glutExtensionSupported(RSTRING_PTR(arg1));
473
+ return INT2NUM(ret);
474
+ }
475
+
476
+ static VALUE
477
+ glut_GetModifiers(obj)
478
+ VALUE obj;
479
+ {
480
+ int ret;
481
+ ret = glutGetModifiers();
482
+ return INT2NUM(ret);
483
+ }
484
+
485
+ static VALUE
486
+ glut_LayerGet(obj,arg1)
487
+ VALUE obj,arg1;
488
+ {
489
+ GLenum type;
490
+ int ret;
491
+ type = (GLenum)NUM2INT(arg1);
492
+ ret = glutLayerGet(type);
493
+ return INT2NUM(ret);
494
+ }
495
+
496
+ /* GLUT font sub-API */
497
+
498
+ /* Some glut implementations define font enums as addresses of local functions
499
+ * which are then called by glut internally. This may lead to crashes or bus
500
+ * errors on some platforms, so to be safe we hardcode the values passed
501
+ * to/from ruby
502
+ */
503
+
504
+ static inline void * bitmap_font_map(int f)
505
+ {
506
+ switch (f) {
507
+ case 0: return (void *)GLUT_BITMAP_9_BY_15;
508
+ case 1: return (void *)GLUT_BITMAP_8_BY_13;
509
+ case 2: return (void *)GLUT_BITMAP_TIMES_ROMAN_10;
510
+ case 3: return (void *)GLUT_BITMAP_TIMES_ROMAN_24;
511
+ case 4: return (void *)GLUT_BITMAP_HELVETICA_10;
512
+ case 5: return (void *)GLUT_BITMAP_HELVETICA_12;
513
+ case 6: return (void *)GLUT_BITMAP_HELVETICA_18;
514
+ default:
515
+ rb_raise(rb_eArgError, "Unsupported font %d", f);
516
+ }
517
+
518
+ return (void *) 0; /* not reached */
519
+ }
520
+
521
+ static inline void * stroke_font_map(int f)
522
+ {
523
+ switch (f) {
524
+ case 7: return (void *)GLUT_STROKE_ROMAN;
525
+ case 8: return (void *)GLUT_STROKE_MONO_ROMAN;
526
+ default:
527
+ rb_raise(rb_eArgError, "Unsupported font %d", f);
528
+ }
529
+
530
+ return (void *) 0; /* not reached */
531
+ }
532
+
533
+ static VALUE
534
+ glut_BitmapCharacter(obj,arg1,arg2)
535
+ VALUE obj,arg1,arg2;
536
+ {
537
+ int character;
538
+ int font;
539
+ font = NUM2INT(arg1);
540
+ character = NUM2INT(arg2);
541
+ glutBitmapCharacter(bitmap_font_map(font),character);
542
+ return Qnil;
543
+ }
544
+
545
+ static VALUE
546
+ glut_BitmapWidth(obj,arg1,arg2)
547
+ VALUE obj,arg1,arg2;
548
+ {
549
+ int font;
550
+ int character;
551
+ int ret;
552
+ font = NUM2INT(arg1);
553
+ character = NUM2INT(arg2);
554
+ ret = glutBitmapWidth(bitmap_font_map(font), character);
555
+ return INT2NUM(ret);
556
+ }
557
+
558
+ static VALUE
559
+ glut_StrokeCharacter(obj,arg1,arg2)
560
+ VALUE obj,arg1,arg2;
561
+ {
562
+ int font;
563
+ int character;
564
+ font = NUM2INT(arg1);
565
+ character = NUM2INT(arg2);
566
+ glutStrokeCharacter(stroke_font_map(font), character);
567
+ return Qnil;
568
+ }
569
+
570
+ static VALUE
571
+ glut_StrokeWidth(obj,arg1,arg2)
572
+ VALUE obj,arg1,arg2;
573
+ {
574
+ int font;
575
+ int character;
576
+ int ret;
577
+ font = NUM2INT(arg1);
578
+ character = NUM2INT(arg2);
579
+ ret = glutStrokeWidth(stroke_font_map(font), character);
580
+ return INT2NUM(ret);
581
+ }
582
+
583
+ static VALUE
584
+ glut_BitmapLength(obj,arg1,arg2)
585
+ VALUE obj,arg1,arg2;
586
+ {
587
+ int font;
588
+ int ret;
589
+ Check_Type(arg2,T_STRING);
590
+ font = NUM2INT(arg1);
591
+ ret = glutBitmapLength(bitmap_font_map(font), (const unsigned char*)RSTRING_PTR(arg2));
592
+ return INT2NUM(ret);
593
+ }
594
+
595
+ static VALUE
596
+ glut_StrokeLength(obj,arg1,arg2)
597
+ VALUE obj,arg1,arg2;
598
+ {
599
+ int font;
600
+ int ret;
601
+ Check_Type(arg2,T_STRING);
602
+ font = NUM2INT(arg1);
603
+ ret = glutStrokeLength(stroke_font_map(font), (const unsigned char*)RSTRING_PTR(arg2));
604
+ return INT2NUM(ret);
605
+ }
606
+
607
+ /* GLUT pre-built models sub-API */
608
+ static VALUE
609
+ glut_WireSphere(obj,arg1,arg2,arg3)
610
+ VALUE obj,arg1,arg2,arg3;
611
+ {
612
+ GLdouble radius;
613
+ GLint slices;
614
+ GLint stacks;
615
+ radius = (GLdouble)NUM2DBL(arg1);
616
+ slices = (GLint)NUM2INT(arg2);
617
+ stacks = (GLint)NUM2INT(arg3);
618
+ glutWireSphere(radius, slices, stacks);
619
+ return Qnil;
620
+ }
621
+
622
+ static VALUE
623
+ glut_SolidSphere(obj,arg1,arg2,arg3)
624
+ VALUE obj,arg1,arg2,arg3;
625
+ {
626
+ GLdouble radius;
627
+ GLint slices;
628
+ GLint stacks;
629
+ radius = (GLdouble)NUM2DBL(arg1);
630
+ slices = (GLint)NUM2INT(arg2);
631
+ stacks = (GLint)NUM2INT(arg3);
632
+ glutSolidSphere(radius, slices, stacks);
633
+ return Qnil;
634
+ }
635
+
636
+ static VALUE
637
+ glut_WireCone(obj,arg1,arg2,arg3,arg4)
638
+ VALUE obj,arg1,arg2,arg3,arg4;
639
+ {
640
+ GLdouble base;
641
+ GLdouble height;
642
+ GLint slices;
643
+ GLint stacks;
644
+ base = (GLdouble)NUM2DBL(arg1);
645
+ height = (GLdouble)NUM2DBL(arg2);
646
+ slices = (GLint)NUM2INT(arg3);
647
+ stacks = (GLint)NUM2INT(arg4);
648
+ glutWireCone(base, height, slices, stacks);
649
+ return Qnil;
650
+ }
651
+
652
+ static VALUE
653
+ glut_SolidCone(obj,arg1,arg2,arg3,arg4)
654
+ VALUE obj,arg1,arg2,arg3,arg4;
655
+ {
656
+ GLdouble base;
657
+ GLdouble height;
658
+ GLint slices;
659
+ GLint stacks;
660
+ base = (GLdouble)NUM2DBL(arg1);
661
+ height = (GLdouble)NUM2DBL(arg2);
662
+ slices = (GLint)NUM2INT(arg3);
663
+ stacks = (GLint)NUM2INT(arg4);
664
+ glutSolidCone(base, height, slices, stacks);
665
+ return Qnil;
666
+ }
667
+
668
+ static VALUE
669
+ glut_WireCube(obj,arg1)
670
+ VALUE obj,arg1;
671
+ {
672
+ GLdouble size;
673
+ size = (GLdouble)NUM2DBL(arg1);
674
+ glutWireCube(size);
675
+ return Qnil;
676
+ }
677
+
678
+ static VALUE
679
+ glut_SolidCube(obj,arg1)
680
+ VALUE obj,arg1;
681
+ {
682
+ GLdouble size;
683
+ size = (GLdouble)NUM2DBL(arg1);
684
+ glutSolidCube(size);
685
+ return Qnil;
686
+ }
687
+
688
+ static VALUE
689
+ glut_WireTorus(obj,arg1,arg2,arg3,arg4)
690
+ VALUE obj,arg1,arg2,arg3,arg4;
691
+ {
692
+ GLdouble innerRadius;
693
+ GLdouble outerRadius;
694
+ GLint sides;
695
+ GLint rings;
696
+ innerRadius = (GLdouble)NUM2DBL(arg1);
697
+ outerRadius = (GLdouble)NUM2DBL(arg2);
698
+ sides = (GLint)NUM2INT(arg3);
699
+ rings = (GLint)NUM2INT(arg4);
700
+ glutWireTorus(innerRadius, outerRadius, sides, rings);
701
+ return Qnil;
702
+ }
703
+
704
+ static VALUE
705
+ glut_SolidTorus(obj,arg1,arg2,arg3,arg4)
706
+ VALUE obj,arg1,arg2,arg3,arg4;
707
+ {
708
+ GLdouble innerRadius;
709
+ GLdouble outerRadius;
710
+ GLint sides;
711
+ GLint rings;
712
+ innerRadius = (GLdouble)NUM2DBL(arg1);
713
+ outerRadius = (GLdouble)NUM2DBL(arg2);
714
+ sides = (GLint)NUM2INT(arg3);
715
+ rings = (GLint)NUM2INT(arg4);
716
+ glutSolidTorus(innerRadius, outerRadius, sides, rings);
717
+ return Qnil;
718
+ }
719
+
720
+ GLUT_SIMPLE_FUNCTION(WireDodecahedron)
721
+ GLUT_SIMPLE_FUNCTION(SolidDodecahedron)
722
+ GLUT_SIMPLE_FUNCTION(WireOctahedron)
723
+ GLUT_SIMPLE_FUNCTION(SolidOctahedron)
724
+ GLUT_SIMPLE_FUNCTION(WireTetrahedron)
725
+ GLUT_SIMPLE_FUNCTION(SolidTetrahedron)
726
+ GLUT_SIMPLE_FUNCTION(WireIcosahedron)
727
+ GLUT_SIMPLE_FUNCTION(SolidIcosahedron)
728
+
729
+ static VALUE
730
+ glut_WireTeapot(obj,arg1)
731
+ VALUE obj,arg1;
732
+ {
733
+ GLdouble size;
734
+ size = (GLdouble)NUM2DBL(arg1);
735
+ glutWireTeapot(size);
736
+ return Qnil;
737
+ }
738
+
739
+ static VALUE
740
+ glut_SolidTeapot(obj,arg1)
741
+ VALUE obj,arg1;
742
+ {
743
+ GLdouble size;
744
+ size = (GLdouble)NUM2DBL(arg1);
745
+ glutSolidTeapot(size);
746
+ return Qnil;
747
+ }
748
+
749
+ /* GLUT video resize sub-API. */
750
+ static VALUE
751
+ glut_VideoResizeGet(obj,arg1)
752
+ VALUE obj,arg1;
753
+ {
754
+ GLenum param;
755
+ int ret;
756
+ param = (GLenum)NUM2INT(arg1);
757
+ ret = glutVideoResizeGet(param);
758
+ return INT2NUM(ret);
759
+ }
760
+
761
+ GLUT_SIMPLE_FUNCTION(SetupVideoResizing)
762
+ GLUT_SIMPLE_FUNCTION(StopVideoResizing)
763
+
764
+ static VALUE
765
+ glut_VideoResize(obj,arg1,arg2,arg3,arg4)
766
+ VALUE obj,arg1,arg2,arg3,arg4;
767
+ {
768
+ int x;
769
+ int y;
770
+ int width;
771
+ int height;
772
+ x = NUM2INT(arg1);
773
+ y = NUM2INT(arg2);
774
+ width = NUM2INT(arg3);
775
+ height = NUM2INT(arg4);
776
+ glutVideoResize(x,y, width, height);
777
+ return Qnil;
778
+ }
779
+
780
+ static VALUE
781
+ glut_VideoPan(obj,arg1,arg2,arg3,arg4)
782
+ VALUE obj,arg1,arg2,arg3,arg4;
783
+ {
784
+ int x;
785
+ int y;
786
+ int width;
787
+ int height;
788
+ x = NUM2INT(arg1);
789
+ y = NUM2INT(arg2);
790
+ width = NUM2INT(arg3);
791
+ height = NUM2INT(arg4);
792
+ glutVideoPan(x,y, width, height);
793
+ return Qnil;
794
+ }
795
+
796
+ /* GLUT debugging sub-API. */
797
+ GLUT_SIMPLE_FUNCTION(ReportErrors)
798
+
799
+ static VALUE
800
+ glut_GameModeString(obj,arg1)
801
+ VALUE obj,arg1;
802
+ {
803
+ Check_Type(arg1,T_STRING);
804
+ glutGameModeString((const char*)RSTRING_PTR(arg1));
805
+ return Qnil;
806
+ }
807
+
808
+ GLUT_SIMPLE_FUNCTION(EnterGameMode)
809
+ GLUT_SIMPLE_FUNCTION(LeaveGameMode)
810
+
811
+ static VALUE
812
+ glut_GameModeGet(obj,arg1)
813
+ VALUE obj,arg1;
814
+ {
815
+ GLenum info;
816
+ int i;
817
+ info = (GLenum)NUM2INT(arg1);
818
+ i = glutGameModeGet(info);
819
+ return INT2NUM(i);
820
+ }
821
+
822
+ static VALUE
823
+ glut_SetKeyRepeat(obj,arg1)
824
+ VALUE obj,arg1;
825
+ {
826
+ GLenum repeatMode;
827
+ repeatMode = (int) NUM2INT(arg1);
828
+ glutSetKeyRepeat(repeatMode);
829
+ return Qnil;
830
+ }
831
+
832
+ static VALUE
833
+ glut_IgnoreKeyRepeat(obj,arg1)
834
+ VALUE obj,arg1;
835
+ {
836
+ GLenum ignore;
837
+ ignore = (int) NUM2INT(arg1);
838
+ glutIgnoreKeyRepeat(ignore);
839
+ return Qnil;
840
+ }
841
+
842
+ static VALUE
843
+ glut_PostWindowOverlayRedisplay(obj,arg1)
844
+ VALUE obj,arg1;
845
+ {
846
+ int win;
847
+ win = (int) NUM2INT(arg1);
848
+ glutPostWindowOverlayRedisplay(win);
849
+ return Qnil;
850
+ }
851
+
852
+ static VALUE
853
+ glut_PostWindowRedisplay(obj,arg1)
854
+ VALUE obj,arg1;
855
+ {
856
+ int win;
857
+ win = (int) NUM2INT(arg1);
858
+ glutPostWindowRedisplay(win);
859
+ return Qnil;
860
+ }
861
+
862
+ void Init_glut_callbacks(void);
863
+ void Init_glut_ext(void);
864
+
865
+ void Init_glut() {
866
+ VALUE mGlut;
867
+
868
+ call_id = rb_intern("call");
869
+ mGlut = rb_define_module("Glut");
870
+
871
+ menu_callback = rb_ary_new();
872
+ rb_global_variable(&menu_callback);
873
+
874
+ rb_define_module_function(mGlut, "glutInit", glut_Init, -1);
875
+ rb_define_module_function(mGlut, "glutInitDisplayMode", glut_InitDisplayMode, 1);
876
+ rb_define_module_function(mGlut, "glutInitDisplayString", glut_InitDisplayString, 1);
877
+ rb_define_module_function(mGlut, "glutInitWindowPosition", glut_InitWindowPosition, 2);
878
+ rb_define_module_function(mGlut, "glutInitWindowSize", glut_InitWindowSize, 2);
879
+ rb_define_module_function(mGlut, "glutMainLoop", glut_MainLoop, 0);
880
+ rb_define_module_function(mGlut, "glutCheckLoop", glut_CheckLoop, 0);
881
+ rb_define_module_function(mGlut, "glutGameModeString", glut_GameModeString, 1);
882
+ rb_define_module_function(mGlut, "glutEnterGameMode", glut_EnterGameMode, 0);
883
+ rb_define_module_function(mGlut, "glutLeaveGameMode", glut_LeaveGameMode, 0);
884
+ rb_define_module_function(mGlut, "glutCreateWindow", glut_CreateWindow, -1);
885
+ rb_define_module_function(mGlut, "glutCreateSubWindow", glut_CreateSubWindow, 5);
886
+ rb_define_module_function(mGlut, "glutDestroyWindow", glut_DestroyWindow, 1);
887
+ rb_define_module_function(mGlut, "glutPostRedisplay", glut_PostRedisplay, 0);
888
+ rb_define_module_function(mGlut, "glutSwapBuffers", glut_SwapBuffers, 0);
889
+ rb_define_module_function(mGlut, "glutGetWindow", glut_GetWindow, 0);
890
+ rb_define_module_function(mGlut, "glutSetWindow", glut_SetWindow, 1);
891
+ rb_define_module_function(mGlut, "glutSetWindowTitle", glut_SetWindowTitle, 1);
892
+ rb_define_module_function(mGlut, "glutSetIconTitle", glut_SetIconTitle, 1);
893
+ rb_define_module_function(mGlut, "glutPositionWindow", glut_PositionWindow, 2);
894
+ rb_define_module_function(mGlut, "glutReshapeWindow", glut_ReshapeWindow, 2);
895
+ rb_define_module_function(mGlut, "glutPopWindow", glut_PopWindow, 0);
896
+ rb_define_module_function(mGlut, "glutPushWindow", glut_PushWindow, 0);
897
+ rb_define_module_function(mGlut, "glutIconifyWindow", glut_IconifyWindow, 0);
898
+ rb_define_module_function(mGlut, "glutShowWindow", glut_ShowWindow, 0);
899
+ rb_define_module_function(mGlut, "glutHideWindow", glut_HideWindow, 0);
900
+ rb_define_module_function(mGlut, "glutFullScreen", glut_FullScreen, 0);
901
+ rb_define_module_function(mGlut, "glutSetCursor", glut_SetCursor, 1);
902
+ rb_define_module_function(mGlut, "glutWarpPointer", glut_WarpPointer, 2);
903
+ rb_define_module_function(mGlut, "glutEstablishOverlay", glut_EstablishOverlay, 0);
904
+ rb_define_module_function(mGlut, "glutRemoveOverlay", glut_RemoveOverlay, 0);
905
+ rb_define_module_function(mGlut, "glutUseLayer", glut_UseLayer, 1);
906
+ rb_define_module_function(mGlut, "glutPostOverlayRedisplay", glut_PostOverlayRedisplay, 0);
907
+ rb_define_module_function(mGlut, "glutShowOverlay", glut_ShowOverlay, 0);
908
+ rb_define_module_function(mGlut, "glutHideOverlay", glut_HideOverlay, 0);
909
+ rb_define_module_function(mGlut, "glutCreateMenu", glut_CreateMenu, 1);
910
+ rb_define_module_function(mGlut, "glutDestroyMenu", glut_DestroyMenu, 1);
911
+ rb_define_module_function(mGlut, "glutGetMenu", glut_GetMenu, 0);
912
+ rb_define_module_function(mGlut, "glutSetMenu", glut_SetMenu, 1);
913
+ rb_define_module_function(mGlut, "glutAddMenuEntry", glut_AddMenuEntry, 2);
914
+ rb_define_module_function(mGlut, "glutAddSubMenu", glut_AddSubMenu, 2);
915
+ rb_define_module_function(mGlut, "glutChangeToMenuEntry", glut_ChangeToMenuEntry, 3);
916
+ rb_define_module_function(mGlut, "glutChangeToSubMenu", glut_ChangeToSubMenu, 3);
917
+ rb_define_module_function(mGlut, "glutRemoveMenuItem", glut_RemoveMenuItem, 1);
918
+ rb_define_module_function(mGlut, "glutAttachMenu", glut_AttachMenu, 1);
919
+ rb_define_module_function(mGlut, "glutDetachMenu", glut_DetachMenu, 1);
920
+ rb_define_module_function(mGlut, "glutSetColor", glut_SetColor, 4);
921
+ rb_define_module_function(mGlut, "glutGetColor", glut_GetColor, 2);
922
+ rb_define_module_function(mGlut, "glutCopyColormap", glut_CopyColormap, 1);
923
+ rb_define_module_function(mGlut, "glutGet", glut_Get, 1);
924
+ rb_define_module_function(mGlut, "glutDeviceGet", glut_DeviceGet, 1);
925
+ rb_define_module_function(mGlut, "glutExtensionSupported", glut_ExtensionSupported, 1);
926
+ rb_define_module_function(mGlut, "glutGetModifiers", glut_GetModifiers, 0);
927
+ rb_define_module_function(mGlut, "glutLayerGet", glut_LayerGet, 1);
928
+ rb_define_module_function(mGlut, "glutBitmapCharacter", glut_BitmapCharacter, 2);
929
+ rb_define_module_function(mGlut, "glutBitmapWidth", glut_BitmapWidth, 2);
930
+ rb_define_module_function(mGlut, "glutStrokeCharacter", glut_StrokeCharacter, 2);
931
+ rb_define_module_function(mGlut, "glutStrokeWidth", glut_StrokeWidth, 2);
932
+ rb_define_module_function(mGlut, "glutBitmapLength", glut_BitmapLength, 2);
933
+ rb_define_module_function(mGlut, "glutStrokeLength", glut_StrokeLength, 2);
934
+ rb_define_module_function(mGlut, "glutWireSphere", glut_WireSphere, 3);
935
+ rb_define_module_function(mGlut, "glutSolidSphere", glut_SolidSphere, 3);
936
+ rb_define_module_function(mGlut, "glutWireCone", glut_WireCone, 4);
937
+ rb_define_module_function(mGlut, "glutSolidCone", glut_SolidCone, 4);
938
+ rb_define_module_function(mGlut, "glutWireCube", glut_WireCube, 1);
939
+ rb_define_module_function(mGlut, "glutSolidCube", glut_SolidCube, 1);
940
+ rb_define_module_function(mGlut, "glutWireTorus", glut_WireTorus, 4);
941
+ rb_define_module_function(mGlut, "glutSolidTorus", glut_SolidTorus, 4);
942
+ rb_define_module_function(mGlut, "glutWireDodecahedron", glut_WireDodecahedron, 0);
943
+ rb_define_module_function(mGlut, "glutSolidDodecahedron", glut_SolidDodecahedron, 0);
944
+ rb_define_module_function(mGlut, "glutWireTeapot", glut_WireTeapot, 1);
945
+ rb_define_module_function(mGlut, "glutSolidTeapot", glut_SolidTeapot, 1);
946
+ rb_define_module_function(mGlut, "glutWireOctahedron", glut_WireOctahedron, 0);
947
+ rb_define_module_function(mGlut, "glutSolidOctahedron", glut_SolidOctahedron, 0);
948
+ rb_define_module_function(mGlut, "glutWireTetrahedron", glut_WireTetrahedron, 0);
949
+ rb_define_module_function(mGlut, "glutSolidTetrahedron", glut_SolidTetrahedron, 0);
950
+ rb_define_module_function(mGlut, "glutWireIcosahedron", glut_WireIcosahedron, 0);
951
+ rb_define_module_function(mGlut, "glutSolidIcosahedron", glut_SolidIcosahedron, 0);
952
+ rb_define_module_function(mGlut, "glutVideoResizeGet", glut_VideoResizeGet, 1);
953
+ rb_define_module_function(mGlut, "glutSetupVideoResizing", glut_SetupVideoResizing, 0);
954
+ rb_define_module_function(mGlut, "glutStopVideoResizing", glut_StopVideoResizing, 0);
955
+ rb_define_module_function(mGlut, "glutVideoResize", glut_VideoResize, 4);
956
+ rb_define_module_function(mGlut, "glutVideoPan", glut_VideoPan, 4);
957
+ rb_define_module_function(mGlut, "glutReportErrors", glut_ReportErrors, 0);
958
+
959
+ rb_define_module_function(mGlut, "glutGameModeGet", glut_GameModeGet, 1);
960
+ rb_define_module_function(mGlut, "glutSetKeyRepeat", glut_SetKeyRepeat, 1);
961
+ rb_define_module_function(mGlut, "glutIgnoreKeyRepeat", glut_IgnoreKeyRepeat, 1);
962
+ rb_define_module_function(mGlut, "glutPostWindowOverlayRedisplay", glut_PostWindowOverlayRedisplay, 1);
963
+ rb_define_module_function(mGlut, "glutPostWindowRedisplay", glut_PostWindowRedisplay, 1);
964
+
965
+ rb_define_const(mGlut, "GLUT_API_VERSION", INT2NUM(GLUT_API_VERSION));
966
+ rb_define_const(mGlut, "GLUT_XLIB_IMPLEMENTATION", INT2NUM(GLUT_XLIB_IMPLEMENTATION));
967
+ rb_define_const(mGlut, "GLUT_RGB", INT2NUM(GLUT_RGB));
968
+ rb_define_const(mGlut, "GLUT_RGBA", INT2NUM(GLUT_RGBA));
969
+ rb_define_const(mGlut, "GLUT_INDEX", INT2NUM(GLUT_INDEX));
970
+ rb_define_const(mGlut, "GLUT_SINGLE", INT2NUM(GLUT_SINGLE));
971
+ rb_define_const(mGlut, "GLUT_DOUBLE", INT2NUM(GLUT_DOUBLE));
972
+ rb_define_const(mGlut, "GLUT_ACCUM", INT2NUM(GLUT_ACCUM));
973
+ rb_define_const(mGlut, "GLUT_ALPHA", INT2NUM(GLUT_ALPHA));
974
+ rb_define_const(mGlut, "GLUT_DEPTH", INT2NUM(GLUT_DEPTH));
975
+ rb_define_const(mGlut, "GLUT_STENCIL", INT2NUM(GLUT_STENCIL));
976
+ rb_define_const(mGlut, "GLUT_MULTISAMPLE", INT2NUM(GLUT_MULTISAMPLE));
977
+ rb_define_const(mGlut, "GLUT_STEREO", INT2NUM(GLUT_STEREO));
978
+ rb_define_const(mGlut, "GLUT_LUMINANCE", INT2NUM(GLUT_LUMINANCE));
979
+ rb_define_const(mGlut, "GLUT_LEFT_BUTTON", INT2NUM(GLUT_LEFT_BUTTON));
980
+ rb_define_const(mGlut, "GLUT_MIDDLE_BUTTON", INT2NUM(GLUT_MIDDLE_BUTTON));
981
+ rb_define_const(mGlut, "GLUT_RIGHT_BUTTON", INT2NUM(GLUT_RIGHT_BUTTON));
982
+ rb_define_const(mGlut, "GLUT_DOWN", INT2NUM(GLUT_DOWN));
983
+ rb_define_const(mGlut, "GLUT_UP", INT2NUM(GLUT_UP));
984
+ rb_define_const(mGlut, "GLUT_KEY_F1", INT2NUM(GLUT_KEY_F1));
985
+ rb_define_const(mGlut, "GLUT_KEY_F2", INT2NUM(GLUT_KEY_F2));
986
+ rb_define_const(mGlut, "GLUT_KEY_F3", INT2NUM(GLUT_KEY_F3));
987
+ rb_define_const(mGlut, "GLUT_KEY_F4", INT2NUM(GLUT_KEY_F4));
988
+ rb_define_const(mGlut, "GLUT_KEY_F5", INT2NUM(GLUT_KEY_F5));
989
+ rb_define_const(mGlut, "GLUT_KEY_F6", INT2NUM(GLUT_KEY_F6));
990
+ rb_define_const(mGlut, "GLUT_KEY_F7", INT2NUM(GLUT_KEY_F7));
991
+ rb_define_const(mGlut, "GLUT_KEY_F8", INT2NUM(GLUT_KEY_F8));
992
+ rb_define_const(mGlut, "GLUT_KEY_F9", INT2NUM(GLUT_KEY_F9));
993
+ rb_define_const(mGlut, "GLUT_KEY_F10", INT2NUM(GLUT_KEY_F10));
994
+ rb_define_const(mGlut, "GLUT_KEY_F11", INT2NUM(GLUT_KEY_F11));
995
+ rb_define_const(mGlut, "GLUT_KEY_F12", INT2NUM(GLUT_KEY_F12));
996
+ rb_define_const(mGlut, "GLUT_KEY_LEFT", INT2NUM(GLUT_KEY_LEFT));
997
+ rb_define_const(mGlut, "GLUT_KEY_UP", INT2NUM(GLUT_KEY_UP));
998
+ rb_define_const(mGlut, "GLUT_KEY_RIGHT", INT2NUM(GLUT_KEY_RIGHT));
999
+ rb_define_const(mGlut, "GLUT_KEY_DOWN", INT2NUM(GLUT_KEY_DOWN));
1000
+ rb_define_const(mGlut, "GLUT_KEY_PAGE_UP", INT2NUM(GLUT_KEY_PAGE_UP));
1001
+ rb_define_const(mGlut, "GLUT_KEY_PAGE_DOWN", INT2NUM(GLUT_KEY_PAGE_DOWN));
1002
+ rb_define_const(mGlut, "GLUT_KEY_HOME", INT2NUM(GLUT_KEY_HOME));
1003
+ rb_define_const(mGlut, "GLUT_KEY_END", INT2NUM(GLUT_KEY_END));
1004
+ rb_define_const(mGlut, "GLUT_KEY_INSERT", INT2NUM(GLUT_KEY_INSERT));
1005
+ rb_define_const(mGlut, "GLUT_LEFT", INT2NUM(GLUT_LEFT));
1006
+ rb_define_const(mGlut, "GLUT_ENTERED", INT2NUM(GLUT_ENTERED));
1007
+ rb_define_const(mGlut, "GLUT_MENU_NOT_IN_USE", INT2NUM(GLUT_MENU_NOT_IN_USE));
1008
+ rb_define_const(mGlut, "GLUT_MENU_IN_USE", INT2NUM(GLUT_MENU_IN_USE));
1009
+ rb_define_const(mGlut, "GLUT_NOT_VISIBLE", INT2NUM(GLUT_NOT_VISIBLE));
1010
+ rb_define_const(mGlut, "GLUT_VISIBLE", INT2NUM(GLUT_VISIBLE));
1011
+ rb_define_const(mGlut, "GLUT_HIDDEN", INT2NUM(GLUT_HIDDEN));
1012
+ rb_define_const(mGlut, "GLUT_FULLY_RETAINED", INT2NUM(GLUT_FULLY_RETAINED));
1013
+ rb_define_const(mGlut, "GLUT_PARTIALLY_RETAINED", INT2NUM(GLUT_PARTIALLY_RETAINED));
1014
+ rb_define_const(mGlut, "GLUT_FULLY_COVERED", INT2NUM(GLUT_FULLY_COVERED));
1015
+ rb_define_const(mGlut, "GLUT_RED", INT2NUM(GLUT_RED));
1016
+ rb_define_const(mGlut, "GLUT_GREEN", INT2NUM(GLUT_GREEN));
1017
+ rb_define_const(mGlut, "GLUT_BLUE", INT2NUM(GLUT_BLUE));
1018
+ rb_define_const(mGlut, "GLUT_WINDOW_X", INT2NUM(GLUT_WINDOW_X));
1019
+ rb_define_const(mGlut, "GLUT_WINDOW_Y", INT2NUM(GLUT_WINDOW_Y));
1020
+ rb_define_const(mGlut, "GLUT_WINDOW_WIDTH", INT2NUM(GLUT_WINDOW_WIDTH));
1021
+ rb_define_const(mGlut, "GLUT_WINDOW_HEIGHT", INT2NUM(GLUT_WINDOW_HEIGHT));
1022
+ rb_define_const(mGlut, "GLUT_WINDOW_BUFFER_SIZE", INT2NUM(GLUT_WINDOW_BUFFER_SIZE));
1023
+ rb_define_const(mGlut, "GLUT_WINDOW_STENCIL_SIZE", INT2NUM(GLUT_WINDOW_STENCIL_SIZE));
1024
+ rb_define_const(mGlut, "GLUT_WINDOW_DEPTH_SIZE", INT2NUM(GLUT_WINDOW_DEPTH_SIZE));
1025
+ rb_define_const(mGlut, "GLUT_WINDOW_RED_SIZE", INT2NUM(GLUT_WINDOW_RED_SIZE));
1026
+ rb_define_const(mGlut, "GLUT_WINDOW_GREEN_SIZE", INT2NUM(GLUT_WINDOW_GREEN_SIZE));
1027
+ rb_define_const(mGlut, "GLUT_WINDOW_BLUE_SIZE", INT2NUM(GLUT_WINDOW_BLUE_SIZE));
1028
+ rb_define_const(mGlut, "GLUT_WINDOW_ALPHA_SIZE", INT2NUM(GLUT_WINDOW_ALPHA_SIZE));
1029
+ rb_define_const(mGlut, "GLUT_WINDOW_ACCUM_RED_SIZE", INT2NUM(GLUT_WINDOW_ACCUM_RED_SIZE));
1030
+ rb_define_const(mGlut, "GLUT_WINDOW_ACCUM_GREEN_SIZE", INT2NUM(GLUT_WINDOW_ACCUM_GREEN_SIZE));
1031
+ rb_define_const(mGlut, "GLUT_WINDOW_ACCUM_BLUE_SIZE", INT2NUM(GLUT_WINDOW_ACCUM_BLUE_SIZE));
1032
+ rb_define_const(mGlut, "GLUT_WINDOW_ACCUM_ALPHA_SIZE", INT2NUM(GLUT_WINDOW_ACCUM_ALPHA_SIZE));
1033
+ rb_define_const(mGlut, "GLUT_WINDOW_DOUBLEBUFFER", INT2NUM(GLUT_WINDOW_DOUBLEBUFFER));
1034
+ rb_define_const(mGlut, "GLUT_WINDOW_RGBA", INT2NUM(GLUT_WINDOW_RGBA));
1035
+ rb_define_const(mGlut, "GLUT_WINDOW_PARENT", INT2NUM(GLUT_WINDOW_PARENT));
1036
+ rb_define_const(mGlut, "GLUT_WINDOW_NUM_CHILDREN", INT2NUM(GLUT_WINDOW_NUM_CHILDREN));
1037
+ rb_define_const(mGlut, "GLUT_WINDOW_COLORMAP_SIZE", INT2NUM(GLUT_WINDOW_COLORMAP_SIZE));
1038
+ rb_define_const(mGlut, "GLUT_WINDOW_NUM_SAMPLES", INT2NUM(GLUT_WINDOW_NUM_SAMPLES));
1039
+ rb_define_const(mGlut, "GLUT_WINDOW_STEREO", INT2NUM(GLUT_WINDOW_STEREO));
1040
+ rb_define_const(mGlut, "GLUT_WINDOW_CURSOR", INT2NUM(GLUT_WINDOW_CURSOR));
1041
+ rb_define_const(mGlut, "GLUT_SCREEN_WIDTH", INT2NUM(GLUT_SCREEN_WIDTH));
1042
+ rb_define_const(mGlut, "GLUT_SCREEN_HEIGHT", INT2NUM(GLUT_SCREEN_HEIGHT));
1043
+ rb_define_const(mGlut, "GLUT_SCREEN_WIDTH_MM", INT2NUM(GLUT_SCREEN_WIDTH_MM));
1044
+ rb_define_const(mGlut, "GLUT_SCREEN_HEIGHT_MM", INT2NUM(GLUT_SCREEN_HEIGHT_MM));
1045
+ rb_define_const(mGlut, "GLUT_MENU_NUM_ITEMS", INT2NUM(GLUT_MENU_NUM_ITEMS));
1046
+ rb_define_const(mGlut, "GLUT_DISPLAY_MODE_POSSIBLE", INT2NUM(GLUT_DISPLAY_MODE_POSSIBLE));
1047
+ rb_define_const(mGlut, "GLUT_INIT_WINDOW_X", INT2NUM(GLUT_INIT_WINDOW_X));
1048
+ rb_define_const(mGlut, "GLUT_INIT_WINDOW_Y", INT2NUM(GLUT_INIT_WINDOW_Y));
1049
+ rb_define_const(mGlut, "GLUT_INIT_WINDOW_WIDTH", INT2NUM(GLUT_INIT_WINDOW_WIDTH));
1050
+ rb_define_const(mGlut, "GLUT_INIT_WINDOW_HEIGHT", INT2NUM(GLUT_INIT_WINDOW_HEIGHT));
1051
+ rb_define_const(mGlut, "GLUT_INIT_DISPLAY_MODE", INT2NUM(GLUT_INIT_DISPLAY_MODE));
1052
+ rb_define_const(mGlut, "GLUT_ELAPSED_TIME", INT2NUM(GLUT_ELAPSED_TIME));
1053
+ rb_define_const(mGlut, "GLUT_HAS_KEYBOARD", INT2NUM(GLUT_HAS_KEYBOARD));
1054
+ rb_define_const(mGlut, "GLUT_HAS_MOUSE", INT2NUM(GLUT_HAS_MOUSE));
1055
+ rb_define_const(mGlut, "GLUT_HAS_SPACEBALL", INT2NUM(GLUT_HAS_SPACEBALL));
1056
+ rb_define_const(mGlut, "GLUT_HAS_DIAL_AND_BUTTON_BOX", INT2NUM(GLUT_HAS_DIAL_AND_BUTTON_BOX));
1057
+ rb_define_const(mGlut, "GLUT_HAS_TABLET", INT2NUM(GLUT_HAS_TABLET));
1058
+ rb_define_const(mGlut, "GLUT_NUM_MOUSE_BUTTONS", INT2NUM(GLUT_NUM_MOUSE_BUTTONS));
1059
+ rb_define_const(mGlut, "GLUT_NUM_SPACEBALL_BUTTONS", INT2NUM(GLUT_NUM_SPACEBALL_BUTTONS));
1060
+ rb_define_const(mGlut, "GLUT_NUM_BUTTON_BOX_BUTTONS", INT2NUM(GLUT_NUM_BUTTON_BOX_BUTTONS));
1061
+ rb_define_const(mGlut, "GLUT_NUM_DIALS", INT2NUM(GLUT_NUM_DIALS));
1062
+ rb_define_const(mGlut, "GLUT_NUM_TABLET_BUTTONS", INT2NUM(GLUT_NUM_TABLET_BUTTONS));
1063
+ rb_define_const(mGlut, "GLUT_OVERLAY_POSSIBLE", INT2NUM(GLUT_OVERLAY_POSSIBLE));
1064
+ rb_define_const(mGlut, "GLUT_LAYER_IN_USE", INT2NUM(GLUT_LAYER_IN_USE));
1065
+ rb_define_const(mGlut, "GLUT_HAS_OVERLAY", INT2NUM(GLUT_HAS_OVERLAY));
1066
+ rb_define_const(mGlut, "GLUT_TRANSPARENT_INDEX", INT2NUM(GLUT_TRANSPARENT_INDEX));
1067
+ rb_define_const(mGlut, "GLUT_NORMAL_DAMAGED", INT2NUM(GLUT_NORMAL_DAMAGED));
1068
+ rb_define_const(mGlut, "GLUT_OVERLAY_DAMAGED", INT2NUM(GLUT_OVERLAY_DAMAGED));
1069
+ rb_define_const(mGlut, "GLUT_VIDEO_RESIZE_POSSIBLE", INT2NUM(GLUT_VIDEO_RESIZE_POSSIBLE));
1070
+ rb_define_const(mGlut, "GLUT_VIDEO_RESIZE_IN_USE", INT2NUM(GLUT_VIDEO_RESIZE_IN_USE));
1071
+ rb_define_const(mGlut, "GLUT_VIDEO_RESIZE_X_DELTA", INT2NUM(GLUT_VIDEO_RESIZE_X_DELTA));
1072
+ rb_define_const(mGlut, "GLUT_VIDEO_RESIZE_Y_DELTA", INT2NUM(GLUT_VIDEO_RESIZE_Y_DELTA));
1073
+ rb_define_const(mGlut, "GLUT_VIDEO_RESIZE_WIDTH_DELTA", INT2NUM(GLUT_VIDEO_RESIZE_WIDTH_DELTA));
1074
+ rb_define_const(mGlut, "GLUT_VIDEO_RESIZE_HEIGHT_DELTA", INT2NUM(GLUT_VIDEO_RESIZE_HEIGHT_DELTA));
1075
+ rb_define_const(mGlut, "GLUT_VIDEO_RESIZE_X", INT2NUM(GLUT_VIDEO_RESIZE_X));
1076
+ rb_define_const(mGlut, "GLUT_VIDEO_RESIZE_Y", INT2NUM(GLUT_VIDEO_RESIZE_Y));
1077
+ rb_define_const(mGlut, "GLUT_VIDEO_RESIZE_WIDTH", INT2NUM(GLUT_VIDEO_RESIZE_WIDTH));
1078
+ rb_define_const(mGlut, "GLUT_VIDEO_RESIZE_HEIGHT", INT2NUM(GLUT_VIDEO_RESIZE_HEIGHT));
1079
+ rb_define_const(mGlut, "GLUT_NORMAL", INT2NUM(GLUT_NORMAL));
1080
+ rb_define_const(mGlut, "GLUT_OVERLAY", INT2NUM(GLUT_OVERLAY));
1081
+ rb_define_const(mGlut, "GLUT_ACTIVE_SHIFT", INT2NUM(GLUT_ACTIVE_SHIFT));
1082
+ rb_define_const(mGlut, "GLUT_ACTIVE_CTRL", INT2NUM(GLUT_ACTIVE_CTRL));
1083
+ rb_define_const(mGlut, "GLUT_ACTIVE_ALT", INT2NUM(GLUT_ACTIVE_ALT));
1084
+ rb_define_const(mGlut, "GLUT_CURSOR_RIGHT_ARROW", INT2NUM(GLUT_CURSOR_RIGHT_ARROW));
1085
+ rb_define_const(mGlut, "GLUT_CURSOR_LEFT_ARROW", INT2NUM(GLUT_CURSOR_LEFT_ARROW));
1086
+ rb_define_const(mGlut, "GLUT_CURSOR_INFO", INT2NUM(GLUT_CURSOR_INFO));
1087
+ rb_define_const(mGlut, "GLUT_CURSOR_DESTROY", INT2NUM(GLUT_CURSOR_DESTROY));
1088
+ rb_define_const(mGlut, "GLUT_CURSOR_HELP", INT2NUM(GLUT_CURSOR_HELP));
1089
+ rb_define_const(mGlut, "GLUT_CURSOR_CYCLE", INT2NUM(GLUT_CURSOR_CYCLE));
1090
+ rb_define_const(mGlut, "GLUT_CURSOR_SPRAY", INT2NUM(GLUT_CURSOR_SPRAY));
1091
+ rb_define_const(mGlut, "GLUT_CURSOR_WAIT", INT2NUM(GLUT_CURSOR_WAIT));
1092
+ rb_define_const(mGlut, "GLUT_CURSOR_TEXT", INT2NUM(GLUT_CURSOR_TEXT));
1093
+ rb_define_const(mGlut, "GLUT_CURSOR_CROSSHAIR", INT2NUM(GLUT_CURSOR_CROSSHAIR));
1094
+ rb_define_const(mGlut, "GLUT_CURSOR_UP_DOWN", INT2NUM(GLUT_CURSOR_UP_DOWN));
1095
+ rb_define_const(mGlut, "GLUT_CURSOR_LEFT_RIGHT", INT2NUM(GLUT_CURSOR_LEFT_RIGHT));
1096
+ rb_define_const(mGlut, "GLUT_CURSOR_TOP_SIDE", INT2NUM(GLUT_CURSOR_TOP_SIDE));
1097
+ rb_define_const(mGlut, "GLUT_CURSOR_BOTTOM_SIDE", INT2NUM(GLUT_CURSOR_BOTTOM_SIDE));
1098
+ rb_define_const(mGlut, "GLUT_CURSOR_LEFT_SIDE", INT2NUM(GLUT_CURSOR_LEFT_SIDE));
1099
+ rb_define_const(mGlut, "GLUT_CURSOR_RIGHT_SIDE", INT2NUM(GLUT_CURSOR_RIGHT_SIDE));
1100
+ rb_define_const(mGlut, "GLUT_CURSOR_TOP_LEFT_CORNER", INT2NUM(GLUT_CURSOR_TOP_LEFT_CORNER));
1101
+ rb_define_const(mGlut, "GLUT_CURSOR_TOP_RIGHT_CORNER", INT2NUM(GLUT_CURSOR_TOP_RIGHT_CORNER));
1102
+ rb_define_const(mGlut, "GLUT_CURSOR_BOTTOM_RIGHT_CORNER", INT2NUM(GLUT_CURSOR_BOTTOM_RIGHT_CORNER));
1103
+ rb_define_const(mGlut, "GLUT_CURSOR_BOTTOM_LEFT_CORNER", INT2NUM(GLUT_CURSOR_BOTTOM_LEFT_CORNER));
1104
+ rb_define_const(mGlut, "GLUT_CURSOR_INHERIT", INT2NUM(GLUT_CURSOR_INHERIT));
1105
+ rb_define_const(mGlut, "GLUT_CURSOR_NONE", INT2NUM(GLUT_CURSOR_NONE));
1106
+ rb_define_const(mGlut, "GLUT_CURSOR_FULL_CROSSHAIR", INT2NUM(GLUT_CURSOR_FULL_CROSSHAIR));
1107
+
1108
+ /* hardcoded, see bitmap_font_map for explanation */
1109
+ rb_define_const(mGlut, "GLUT_BITMAP_9_BY_15", INT2NUM(0));
1110
+ rb_define_const(mGlut, "GLUT_BITMAP_8_BY_13", INT2NUM(1));
1111
+ rb_define_const(mGlut, "GLUT_BITMAP_TIMES_ROMAN_10", INT2NUM(2));
1112
+ rb_define_const(mGlut, "GLUT_BITMAP_TIMES_ROMAN_24", INT2NUM(3));
1113
+ rb_define_const(mGlut, "GLUT_BITMAP_HELVETICA_10", INT2NUM(4));
1114
+ rb_define_const(mGlut, "GLUT_BITMAP_HELVETICA_12", INT2NUM(5));
1115
+ rb_define_const(mGlut, "GLUT_BITMAP_HELVETICA_18", INT2NUM(6));
1116
+ rb_define_const(mGlut, "GLUT_STROKE_ROMAN", INT2NUM(7));
1117
+ rb_define_const(mGlut, "GLUT_STROKE_MONO_ROMAN", INT2NUM(8));
1118
+
1119
+ rb_define_const(mGlut, "GLUT_WINDOW_FORMAT_ID", INT2NUM(GLUT_WINDOW_FORMAT_ID));
1120
+ rb_define_const(mGlut, "GLUT_DEVICE_IGNORE_KEY_REPEAT", INT2NUM(GLUT_DEVICE_IGNORE_KEY_REPEAT));
1121
+ rb_define_const(mGlut, "GLUT_DEVICE_KEY_REPEAT", INT2NUM(GLUT_DEVICE_KEY_REPEAT));
1122
+ rb_define_const(mGlut, "GLUT_HAS_JOYSTICK", INT2NUM(GLUT_HAS_JOYSTICK));
1123
+ rb_define_const(mGlut, "GLUT_OWNS_JOYSTICK", INT2NUM(GLUT_OWNS_JOYSTICK));
1124
+ rb_define_const(mGlut, "GLUT_JOYSTICK_BUTTONS", INT2NUM(GLUT_JOYSTICK_BUTTONS));
1125
+ rb_define_const(mGlut, "GLUT_JOYSTICK_AXES", INT2NUM(GLUT_JOYSTICK_AXES));
1126
+ rb_define_const(mGlut, "GLUT_JOYSTICK_POLL_RATE", INT2NUM(GLUT_JOYSTICK_POLL_RATE));
1127
+ rb_define_const(mGlut, "GLUT_KEY_REPEAT_OFF", INT2NUM(GLUT_KEY_REPEAT_OFF));
1128
+ rb_define_const(mGlut, "GLUT_KEY_REPEAT_ON", INT2NUM(GLUT_KEY_REPEAT_ON));
1129
+ rb_define_const(mGlut, "GLUT_KEY_REPEAT_DEFAULT", INT2NUM(GLUT_KEY_REPEAT_DEFAULT));
1130
+ rb_define_const(mGlut, "GLUT_JOYSTICK_BUTTON_A", INT2NUM(GLUT_JOYSTICK_BUTTON_A));
1131
+ rb_define_const(mGlut, "GLUT_JOYSTICK_BUTTON_B", INT2NUM(GLUT_JOYSTICK_BUTTON_B));
1132
+ rb_define_const(mGlut, "GLUT_JOYSTICK_BUTTON_C", INT2NUM(GLUT_JOYSTICK_BUTTON_C));
1133
+ rb_define_const(mGlut, "GLUT_JOYSTICK_BUTTON_D", INT2NUM(GLUT_JOYSTICK_BUTTON_D));
1134
+ rb_define_const(mGlut, "GLUT_GAME_MODE_ACTIVE", INT2NUM(GLUT_GAME_MODE_ACTIVE));
1135
+ rb_define_const(mGlut, "GLUT_GAME_MODE_POSSIBLE", INT2NUM(GLUT_GAME_MODE_POSSIBLE));
1136
+ rb_define_const(mGlut, "GLUT_GAME_MODE_WIDTH", INT2NUM(GLUT_GAME_MODE_WIDTH));
1137
+ rb_define_const(mGlut, "GLUT_GAME_MODE_HEIGHT", INT2NUM(GLUT_GAME_MODE_HEIGHT));
1138
+ rb_define_const(mGlut, "GLUT_GAME_MODE_PIXEL_DEPTH", INT2NUM(GLUT_GAME_MODE_PIXEL_DEPTH));
1139
+ rb_define_const(mGlut, "GLUT_GAME_MODE_REFRESH_RATE", INT2NUM(GLUT_GAME_MODE_REFRESH_RATE));
1140
+ rb_define_const(mGlut, "GLUT_GAME_MODE_DISPLAY_CHANGED", INT2NUM(GLUT_GAME_MODE_DISPLAY_CHANGED));
1141
+
1142
+ // Some OSX specific constants
1143
+ #ifdef GLUT_NO_RECOVERY
1144
+ rb_define_const(mGlut, "GLUT_NO_RECOVERY", INT2NUM(GLUT_NO_RECOVERY));
1145
+ #endif
1146
+ #ifdef GLUT_3_2_CORE_PROFILE
1147
+ rb_define_const(mGlut, "GLUT_3_2_CORE_PROFILE", INT2NUM(GLUT_3_2_CORE_PROFILE));
1148
+ #endif
1149
+
1150
+ Init_glut_callbacks();
1151
+ Init_glut_ext();
1152
+ }