opengl 0.8.0 → 0.9.0

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