ruby-opengl 0.60.1 → 0.61.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.
Files changed (127) hide show
  1. metadata +36 -186
  2. data/Rakefile +0 -168
  3. data/doc/build_install.txt +0 -122
  4. data/doc/extensions.txt +0 -556
  5. data/doc/extensions.txt.in +0 -348
  6. data/doc/history.txt +0 -66
  7. data/doc/requirements_and_design.txt +0 -117
  8. data/doc/roadmap.txt +0 -28
  9. data/doc/scientific_use.txt +0 -35
  10. data/doc/supplies/page_template.html +0 -71
  11. data/doc/thanks.txt +0 -29
  12. data/doc/tutorial.txt +0 -469
  13. data/examples/NeHe/nehe_lesson02.rb +0 -117
  14. data/examples/NeHe/nehe_lesson03.rb +0 -122
  15. data/examples/NeHe/nehe_lesson04.rb +0 -133
  16. data/examples/NeHe/nehe_lesson05.rb +0 -186
  17. data/examples/NeHe/nehe_lesson36.rb +0 -303
  18. data/examples/OrangeBook/3Dlabs-License.txt +0 -33
  19. data/examples/OrangeBook/brick.frag +0 -36
  20. data/examples/OrangeBook/brick.rb +0 -376
  21. data/examples/OrangeBook/brick.vert +0 -41
  22. data/examples/OrangeBook/particle.frag +0 -17
  23. data/examples/OrangeBook/particle.rb +0 -406
  24. data/examples/OrangeBook/particle.vert +0 -38
  25. data/examples/README +0 -16
  26. data/examples/RedBook/aapoly.rb +0 -142
  27. data/examples/RedBook/aargb.rb +0 -119
  28. data/examples/RedBook/accanti.rb +0 -162
  29. data/examples/RedBook/accpersp.rb +0 -215
  30. data/examples/RedBook/alpha.rb +0 -123
  31. data/examples/RedBook/alpha3D.rb +0 -158
  32. data/examples/RedBook/bezcurve.rb +0 -105
  33. data/examples/RedBook/bezmesh.rb +0 -137
  34. data/examples/RedBook/checker.rb +0 -124
  35. data/examples/RedBook/clip.rb +0 -95
  36. data/examples/RedBook/colormat.rb +0 -135
  37. data/examples/RedBook/cube.rb +0 -69
  38. data/examples/RedBook/depthcue.rb +0 -99
  39. data/examples/RedBook/dof.rb +0 -205
  40. data/examples/RedBook/double.rb +0 -105
  41. data/examples/RedBook/drawf.rb +0 -91
  42. data/examples/RedBook/feedback.rb +0 -145
  43. data/examples/RedBook/fog.rb +0 -167
  44. data/examples/RedBook/font.rb +0 -151
  45. data/examples/RedBook/hello.rb +0 -79
  46. data/examples/RedBook/image.rb +0 -137
  47. data/examples/RedBook/jitter.rb +0 -207
  48. data/examples/RedBook/lines.rb +0 -128
  49. data/examples/RedBook/list.rb +0 -111
  50. data/examples/RedBook/material.rb +0 -275
  51. data/examples/RedBook/mipmap.rb +0 -156
  52. data/examples/RedBook/model.rb +0 -113
  53. data/examples/RedBook/movelight.rb +0 -132
  54. data/examples/RedBook/pickdepth.rb +0 -179
  55. data/examples/RedBook/planet.rb +0 -108
  56. data/examples/RedBook/quadric.rb +0 -158
  57. data/examples/RedBook/robot.rb +0 -115
  58. data/examples/RedBook/select.rb +0 -196
  59. data/examples/RedBook/smooth.rb +0 -95
  60. data/examples/RedBook/stencil.rb +0 -163
  61. data/examples/RedBook/stroke.rb +0 -167
  62. data/examples/RedBook/surface.rb +0 -166
  63. data/examples/RedBook/teaambient.rb +0 -132
  64. data/examples/RedBook/teapots.rb +0 -182
  65. data/examples/RedBook/tess.rb +0 -183
  66. data/examples/RedBook/texbind.rb +0 -147
  67. data/examples/RedBook/texgen.rb +0 -169
  68. data/examples/RedBook/texturesurf.rb +0 -128
  69. data/examples/RedBook/varray.rb +0 -159
  70. data/examples/RedBook/wrap.rb +0 -148
  71. data/examples/misc/OGLBench.rb +0 -337
  72. data/examples/misc/anisotropic.rb +0 -194
  73. data/examples/misc/fbo_test.rb +0 -356
  74. data/examples/misc/font-glut.rb +0 -46
  75. data/examples/misc/glfwtest.rb +0 -30
  76. data/examples/misc/plane.rb +0 -161
  77. data/examples/misc/readpixel.rb +0 -65
  78. data/examples/misc/sdltest.rb +0 -34
  79. data/examples/misc/trislam.rb +0 -828
  80. data/ext/common/common.h +0 -423
  81. data/ext/common/conv.h +0 -244
  82. data/ext/common/funcdef.h +0 -280
  83. data/ext/common/gl-enums.h +0 -10031
  84. data/ext/common/gl-error.h +0 -23
  85. data/ext/common/gl-types.h +0 -61
  86. data/ext/common/glu-enums.h +0 -463
  87. data/ext/gl/gl-1.0-1.1.c +0 -2817
  88. data/ext/gl/gl-1.2.c +0 -814
  89. data/ext/gl/gl-1.3.c +0 -444
  90. data/ext/gl/gl-1.4.c +0 -349
  91. data/ext/gl/gl-1.5.c +0 -225
  92. data/ext/gl/gl-2.0.c +0 -657
  93. data/ext/gl/gl-2.1.c +0 -57
  94. data/ext/gl/gl-enums.c +0 -3354
  95. data/ext/gl/gl-error.c +0 -104
  96. data/ext/gl/gl-ext-3dfx.c +0 -27
  97. data/ext/gl/gl-ext-arb.c +0 -866
  98. data/ext/gl/gl-ext-ati.c +0 -41
  99. data/ext/gl/gl-ext-ext.c +0 -890
  100. data/ext/gl/gl-ext-gremedy.c +0 -41
  101. data/ext/gl/gl-ext-nv.c +0 -679
  102. data/ext/gl/gl.c +0 -214
  103. data/ext/gl/mkrf_conf.rb +0 -34
  104. data/ext/glu/glu-enums.c +0 -164
  105. data/ext/glu/glu.c +0 -1530
  106. data/ext/glu/mkrf_conf.rb +0 -35
  107. data/ext/glut/glut.c +0 -1623
  108. data/ext/glut/mkrf_conf.rb +0 -37
  109. data/lib/opengl.rb +0 -84
  110. data/test/README +0 -10
  111. data/test/tc_common.rb +0 -98
  112. data/test/tc_ext_arb.rb +0 -467
  113. data/test/tc_ext_ati.rb +0 -33
  114. data/test/tc_ext_ext.rb +0 -551
  115. data/test/tc_ext_gremedy.rb +0 -36
  116. data/test/tc_ext_nv.rb +0 -357
  117. data/test/tc_func_10_11.rb +0 -1281
  118. data/test/tc_func_12.rb +0 -186
  119. data/test/tc_func_13.rb +0 -229
  120. data/test/tc_func_14.rb +0 -197
  121. data/test/tc_func_15.rb +0 -270
  122. data/test/tc_func_20.rb +0 -346
  123. data/test/tc_func_21.rb +0 -541
  124. data/test/tc_glu.rb +0 -310
  125. data/test/tc_include_gl.rb +0 -35
  126. data/test/tc_misc.rb +0 -54
  127. data/test/tc_require_gl.rb +0 -34
@@ -1,35 +0,0 @@
1
- # extconf.rb for ruby-opengl's glu extension module.
2
- #
3
- # Copyright (C) 2006 John M. Gabriele <jmg3000@gmail.com>
4
- #
5
- # This program is distributed under the terms of the MIT license.
6
- # See the included COPYRIGHT file for the terms of this license.
7
- #
8
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
9
- # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
10
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
11
- # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
12
- # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
13
- # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
14
- # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
-
16
- require 'rubygems'
17
- require 'mkrf'
18
-
19
- RUBYVER = " -DRUBY_VERSION=" + RUBY_VERSION.split(".").join
20
-
21
- Mkrf::Generator.new( 'glu' ) do |g|
22
- case RUBY_PLATFORM
23
- when /darwin/
24
- g.cflags << RUBYVER
25
- g.ldshared << ' -framework OpenGL'
26
- when /mswin32/
27
- g.cflags << ' -DWIN32' + RUBYVER
28
- g.include_library( 'opengl32.lib', 'glVertex3d')
29
- g.include_library( 'glu32.lib', 'gluLookAt')
30
- else
31
- g.cflags << ' -Wall' + RUBYVER
32
- g.include_library( 'GLU', 'gluLookAt' )
33
- g.include_library( 'GL', 'glVertex3d')
34
- end
35
- end
@@ -1,1623 +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/common.h"
24
-
25
- static int callId; /* 'call' method id */
26
-
27
- /*
28
- macros for registering callbacks -
29
-
30
- most GLUT callback functions are part of specific window state, so
31
- the same callback may have different functions for each GLUT window
32
-
33
- callbacks that are not tied to specific window (idle,timer,menustate) are registered manually
34
- */
35
-
36
- #define WINDOW_CALLBACK_SETUP(_funcname) \
37
- static VALUE _funcname = Qnil; \
38
- static VALUE \
39
- glut_ ## _funcname(obj,arg1) \
40
- VALUE obj,arg1; \
41
- { \
42
- int win; \
43
- if (!rb_obj_is_kind_of(arg1,rb_cProc) && !NIL_P(arg1)) \
44
- rb_raise(rb_eTypeError, "glut%s:%s",#_funcname, rb_class2name(CLASS_OF(arg1))); \
45
- win = glutGetWindow(); \
46
- if (win == 0) \
47
- rb_raise(rb_eRuntimeError, "glut%s needs current window", #_funcname); \
48
- rb_ary_store(_funcname, win, arg1); \
49
- if(NIL_P(arg1)) \
50
- glut ## _funcname(NULL); \
51
- else \
52
- glut##_funcname(&glut_##_funcname##Callback); \
53
- return Qnil; \
54
- }
55
-
56
- #define WINDOW_CALLBACK_DEFINE(_funcname) \
57
- rb_define_module_function(module, "glut" # _funcname, glut_ ## _funcname , 1); \
58
- rb_global_variable(&_funcname); \
59
- _funcname = rb_ary_new()
60
-
61
- #define GLUT_SIMPLE_FUNCTION(_name_) \
62
- static VALUE \
63
- glut_##_name_(obj) \
64
- VALUE obj; \
65
- { \
66
- glut##_name_(); \
67
- return Qnil; \
68
- }
69
-
70
-
71
- /*
72
- * GLUT Implementation
73
- */
74
-
75
- /* GLUT initialization sub-API. */
76
-
77
- static VALUE glut_Init( int argc, VALUE * argv, VALUE obj)
78
- {
79
- int largc;
80
- char** largv;
81
- VALUE new_argv;
82
- VALUE orig_arg;
83
- int i;
84
-
85
- if (rb_scan_args(argc, argv, "01", &orig_arg) == 0)
86
- orig_arg = rb_eval_string("[$0] + ARGV");
87
- else
88
- Check_Type(orig_arg, T_ARRAY);
89
-
90
- /* converts commandline parameters from ruby to C, passes them
91
- to glutInit and returns the parameters stripped of glut-specific
92
- commands ("-display","-geometry" etc.) */
93
- largc = RARRAY_LEN(orig_arg);
94
- largv = ALLOCA_N(char*, largc);
95
- for (i = 0; i < largc; i++)
96
- largv[i] = STR2CSTR(RARRAY_PTR(orig_arg)[i]);
97
-
98
- glutInit(&largc, largv);
99
-
100
- new_argv = rb_ary_new2(largc);
101
- for (i = 0; i < largc; i++)
102
- rb_ary_push(new_argv,rb_str_new2(largv[i]));
103
-
104
- rb_ary_shift(new_argv);
105
-
106
- return new_argv;
107
- }
108
-
109
-
110
- static VALUE glut_InitDisplayMode(obj,arg1)
111
- VALUE obj,arg1;
112
- {
113
- unsigned int mode;
114
- mode = (unsigned int)NUM2INT(arg1);
115
- glutInitDisplayMode(mode);
116
- return Qnil;
117
- }
118
-
119
- static VALUE
120
- glut_InitDisplayString(obj,arg1)
121
- VALUE obj,arg1;
122
- {
123
- Check_Type(arg1,T_STRING);
124
- glutInitDisplayString(RSTRING_PTR(arg1));
125
- return Qnil;
126
- }
127
-
128
- static VALUE
129
- glut_InitWindowPosition(obj,arg1,arg2)
130
- VALUE obj,arg1,arg2;
131
- {
132
- int x,y;
133
- x = NUM2INT(arg1);
134
- y = NUM2INT(arg2);
135
- glutInitWindowPosition(x,y);
136
- return Qnil;
137
- }
138
-
139
-
140
- static VALUE
141
- glut_InitWindowSize(obj, arg1, arg2)
142
- VALUE obj,arg1,arg2;
143
- {
144
- int width,height;
145
- width = NUM2INT(arg1);
146
- height = NUM2INT(arg2);
147
- glutInitWindowSize(width,height);
148
- return Qnil;
149
- }
150
-
151
- GLUT_SIMPLE_FUNCTION(MainLoop)
152
-
153
- static void GLUTCALLBACK glut_DisplayFuncCallback(void);
154
- static void GLUTCALLBACK glut_ReshapeFuncCallback(int,int);
155
- static void GLUTCALLBACK glut_KeyboardFuncCallback(unsigned char, int, int);
156
- static void GLUTCALLBACK glut_MouseFuncCallback(int, int, int, int);
157
- static void GLUTCALLBACK glut_MotionFuncCallback(int, int);
158
- static void GLUTCALLBACK glut_PassiveMotionFuncCallback(int, int);
159
- static void GLUTCALLBACK glut_EntryFuncCallback(int);
160
- static void GLUTCALLBACK glut_VisibilityFuncCallback(int);
161
- static void GLUTCALLBACK glut_SpecialFuncCallback(int,int,int);
162
- static void GLUTCALLBACK glut_SpaceballMotionFuncCallback(int,int,int);
163
- static void GLUTCALLBACK glut_SpaceballRotateFuncCallback(int,int,int);
164
- static void GLUTCALLBACK glut_SpaceballButtonFuncCallback(int,int);
165
- static void GLUTCALLBACK glut_ButtonBoxFuncCallback(int,int);
166
- static void GLUTCALLBACK glut_DialsFuncCallback(int,int);
167
- static void GLUTCALLBACK glut_TabletMotionFuncCallback(int,int);
168
- static void GLUTCALLBACK glut_TabletButtonFuncCallback(int,int,int,int);
169
- static void GLUTCALLBACK glut_OverlayDisplayFuncCallback(void);
170
- static void GLUTCALLBACK glut_WindowStatusFuncCallback(int);
171
- static void GLUTCALLBACK glut_JoystickFuncCallback(unsigned int,int,int,int);
172
- static void GLUTCALLBACK glut_KeyboardUpFuncCallback(unsigned char,int,int);
173
- static void GLUTCALLBACK glut_SpecialUpFuncCallback(int,int,int);
174
-
175
- WINDOW_CALLBACK_SETUP(DisplayFunc)
176
- WINDOW_CALLBACK_SETUP(ReshapeFunc)
177
- WINDOW_CALLBACK_SETUP(KeyboardFunc)
178
- WINDOW_CALLBACK_SETUP(MouseFunc)
179
- WINDOW_CALLBACK_SETUP(MotionFunc)
180
- WINDOW_CALLBACK_SETUP(PassiveMotionFunc)
181
- WINDOW_CALLBACK_SETUP(EntryFunc)
182
- WINDOW_CALLBACK_SETUP(VisibilityFunc)
183
- WINDOW_CALLBACK_SETUP(SpecialFunc)
184
- WINDOW_CALLBACK_SETUP(SpaceballMotionFunc)
185
- WINDOW_CALLBACK_SETUP(SpaceballRotateFunc)
186
- WINDOW_CALLBACK_SETUP(SpaceballButtonFunc)
187
- WINDOW_CALLBACK_SETUP(ButtonBoxFunc)
188
- WINDOW_CALLBACK_SETUP(DialsFunc)
189
- WINDOW_CALLBACK_SETUP(TabletMotionFunc)
190
- WINDOW_CALLBACK_SETUP(TabletButtonFunc)
191
- WINDOW_CALLBACK_SETUP(OverlayDisplayFunc)
192
- WINDOW_CALLBACK_SETUP(WindowStatusFunc)
193
- WINDOW_CALLBACK_SETUP(KeyboardUpFunc)
194
- WINDOW_CALLBACK_SETUP(SpecialUpFunc)
195
-
196
- /* special case, 2 params */
197
- static VALUE JoystickFunc = Qnil;
198
- static VALUE
199
- glut_JoystickFunc(obj,arg1,arg2)
200
- VALUE obj,arg1,arg2;
201
- {
202
- int win;
203
- int pollinterval;
204
- if (!rb_obj_is_kind_of(arg1,rb_cProc) && !NIL_P(arg1))
205
- rb_raise(rb_eTypeError, "glutJoystickFunc:%s", rb_class2name(CLASS_OF(arg1)));
206
- pollinterval=NUM2INT(arg2);
207
- win = glutGetWindow();
208
- if (win == 0)
209
- rb_raise(rb_eRuntimeError, "glutJoystickFunc needs current window");
210
- rb_ary_store(JoystickFunc, win, arg1);
211
- if (NIL_P(arg1))
212
- glutJoystickFunc(NULL,pollinterval);
213
- else
214
- glutJoystickFunc(glut_JoystickFuncCallback,pollinterval);
215
- return Qnil;
216
- }
217
-
218
- /* GLUT window sub-API. */
219
- static VALUE glut_CreateWindow(argc, argv, obj)
220
- int argc;
221
- VALUE* argv;
222
- VALUE obj;
223
- {
224
- int ret;
225
- VALUE title;
226
- rb_scan_args(argc, argv, "01", &title);
227
- if (argc == 0)
228
- title = rb_eval_string("$0");
229
- Check_Type(title,T_STRING);
230
- ret = glutCreateWindow(RSTRING_PTR(title));
231
- return INT2NUM(ret);
232
- }
233
-
234
-
235
- static VALUE
236
- glut_CreateSubWindow(obj,arg1,arg2,arg3,arg4,arg5)
237
- VALUE obj,arg1,arg2,arg3,arg4,arg5;
238
- {
239
- int win, x, y, width, height;
240
- int ret;
241
- win = NUM2INT(arg1);
242
- x = NUM2INT(arg2);
243
- y = NUM2INT(arg3);
244
- width = NUM2INT(arg4);
245
- height = NUM2INT(arg5);
246
- ret = glutCreateSubWindow(win, x, y, width, height);
247
- return INT2NUM(ret);
248
- }
249
-
250
- static VALUE
251
- glut_DestroyWindow(obj,arg1)
252
- VALUE obj,arg1;
253
- {
254
- int win;
255
- win = NUM2INT(arg1);
256
- glutDestroyWindow(win);
257
- return Qnil;
258
- }
259
-
260
- GLUT_SIMPLE_FUNCTION(PostRedisplay)
261
-
262
- GLUT_SIMPLE_FUNCTION(SwapBuffers)
263
-
264
- static VALUE
265
- glut_GetWindow(obj)
266
- VALUE obj;
267
- {
268
- int ret;
269
- ret = glutGetWindow();
270
- return INT2NUM(ret);
271
- }
272
-
273
-
274
- static VALUE
275
- glut_SetWindow(obj,arg1)
276
- VALUE obj,arg1;
277
- {
278
- int win;
279
- win = NUM2INT(arg1);
280
- glutSetWindow(win);
281
- return Qnil;
282
- }
283
-
284
-
285
- static VALUE
286
- glut_SetWindowTitle(obj,arg1)
287
- VALUE obj,arg1;
288
- {
289
- Check_Type(arg1,T_STRING);
290
- glutSetWindowTitle(RSTRING_PTR(arg1));
291
- return Qnil;
292
- }
293
-
294
-
295
- static VALUE
296
- glut_SetIconTitle(obj, arg1)
297
- VALUE obj,arg1;
298
- {
299
- Check_Type(arg1,T_STRING);
300
- glutSetIconTitle(RSTRING_PTR(arg1));
301
- return Qnil;
302
- }
303
-
304
-
305
- static VALUE
306
- glut_PositionWindow(obj,arg1,arg2)
307
- VALUE obj,arg1,arg2;
308
- {
309
- int x,y;
310
- x = NUM2INT(arg1);
311
- y = NUM2INT(arg2);
312
- glutPositionWindow(x,y);
313
- return Qnil;
314
- }
315
-
316
-
317
- static VALUE
318
- glut_ReshapeWindow(obj,arg1,arg2)
319
- VALUE obj,arg1,arg2;
320
- {
321
- int width,height;
322
- width = NUM2INT(arg1);
323
- height = NUM2INT(arg2);
324
- glutReshapeWindow(width, height);
325
- return Qnil;
326
- }
327
-
328
-
329
- GLUT_SIMPLE_FUNCTION(PopWindow)
330
- GLUT_SIMPLE_FUNCTION(PushWindow)
331
- GLUT_SIMPLE_FUNCTION(IconifyWindow)
332
- GLUT_SIMPLE_FUNCTION(ShowWindow)
333
- GLUT_SIMPLE_FUNCTION(HideWindow)
334
- GLUT_SIMPLE_FUNCTION(FullScreen)
335
-
336
-
337
- static VALUE
338
- glut_SetCursor(obj,arg1)
339
- VALUE obj,arg1;
340
- {
341
- int cursor;
342
- cursor = NUM2INT(arg1);
343
- glutSetCursor(cursor);
344
- return Qnil;
345
- }
346
-
347
- static VALUE
348
- glut_WarpPointer(obj,arg1,arg2)
349
- VALUE obj,arg1,arg2;
350
- {
351
- int x,y;
352
- x = NUM2INT(arg1);
353
- y = NUM2INT(arg2);
354
- glutWarpPointer(x,y);
355
- return Qnil;
356
- }
357
-
358
- /* GLUT overlay sub-API. */
359
- GLUT_SIMPLE_FUNCTION(EstablishOverlay)
360
- GLUT_SIMPLE_FUNCTION(RemoveOverlay)
361
- GLUT_SIMPLE_FUNCTION(PostOverlayRedisplay)
362
- GLUT_SIMPLE_FUNCTION(ShowOverlay)
363
- GLUT_SIMPLE_FUNCTION(HideOverlay)
364
-
365
- static VALUE
366
- glut_UseLayer(obj,arg1)
367
- {
368
- GLenum layer;
369
- layer = (GLenum)NUM2INT(arg1);
370
- glutUseLayer(layer);
371
- return Qnil;
372
- }
373
-
374
- /* GLUT menu sub-API. */
375
- static VALUE g_menucallback = Qnil;
376
- static void GLUTCALLBACK
377
- glut_CreateMenuCallback(int value)
378
- {
379
- VALUE func;
380
- int menu;
381
- menu = glutGetMenu();
382
- func = rb_ary_entry(g_menucallback,menu);
383
- rb_funcall(func, callId, 1, INT2NUM(value));
384
- }
385
-
386
-
387
- static VALUE
388
- glut_CreateMenu(obj,arg1)
389
- VALUE obj,arg1;
390
- {
391
- int menu;
392
- if (!rb_obj_is_kind_of(arg1,rb_cProc) && !NIL_P(arg1))
393
- rb_raise(rb_eTypeError, "glutCreateMenu:%s", rb_class2name(CLASS_OF(arg1)));
394
-
395
- if (NIL_P(arg1))
396
- menu = glutCreateMenu(NULL);
397
- else
398
- menu = glutCreateMenu(glut_CreateMenuCallback);
399
-
400
- rb_ary_store(g_menucallback,menu,arg1);
401
- return INT2FIX(menu);
402
- }
403
-
404
-
405
- static VALUE
406
- glut_DestroyMenu(obj,arg1)
407
- VALUE obj,arg1;
408
- {
409
- int menu;
410
- menu = NUM2INT(arg1);
411
- glutDestroyMenu(menu);
412
- //rb_hash_aset(g_menucallback, menu, Qnil);
413
- //rb_hash_aset(g_menuargs, menu, Qnil);
414
- return Qnil;
415
- }
416
-
417
-
418
- static VALUE
419
- glut_GetMenu(obj)
420
- VALUE obj;
421
- {
422
- int ret;
423
- ret = glutGetMenu();
424
- return INT2NUM(ret);
425
- }
426
-
427
-
428
- static VALUE
429
- glut_SetMenu(obj,arg1)
430
- VALUE obj,arg1;
431
- {
432
- glutSetMenu(NUM2INT(arg1));
433
- return Qnil;
434
- }
435
-
436
-
437
- static VALUE
438
- glut_AddMenuEntry(obj,arg1,arg2)
439
- VALUE obj,arg1,arg2;
440
- {
441
- Check_Type(arg1,T_STRING);
442
- glutAddMenuEntry(RSTRING_PTR(arg1), NUM2INT(arg2));
443
- return Qnil;
444
- }
445
-
446
-
447
- static VALUE
448
- glut_AddSubMenu(obj,arg1,arg2)
449
- VALUE obj,arg1,arg2;
450
- {
451
- Check_Type(arg1,T_STRING);
452
- glutAddSubMenu(RSTRING_PTR(arg1), NUM2INT(arg2));
453
- return Qnil;
454
- }
455
-
456
-
457
- static VALUE glut_ChangeToMenuEntry(obj,arg1,arg2,arg3)
458
- VALUE obj,arg1,arg2,arg3;
459
- {
460
- Check_Type(arg2,T_STRING);
461
- glutChangeToMenuEntry(NUM2INT(arg1), RSTRING_PTR(arg2), NUM2INT(arg3));
462
- return Qnil;
463
- }
464
-
465
-
466
- static VALUE glut_ChangeToSubMenu(obj,arg1,arg2,arg3)
467
- VALUE obj,arg1,arg2,arg3;
468
- {
469
- Check_Type(arg2,T_STRING);
470
- glutChangeToSubMenu(NUM2INT(arg1), RSTRING_PTR(arg2), NUM2INT(arg3));
471
- return Qnil;
472
- }
473
-
474
-
475
- static VALUE glut_RemoveMenuItem( VALUE obj, VALUE arg1 )
476
- {
477
- glutRemoveMenuItem(NUM2INT(arg1));
478
- return Qnil;
479
- }
480
-
481
-
482
- static VALUE
483
- glut_AttachMenu(obj,arg1)
484
- VALUE obj, arg1;
485
- {
486
- glutAttachMenu(NUM2INT(arg1));
487
- return Qnil;
488
- }
489
-
490
-
491
- static VALUE
492
- glut_DetachMenu(obj,arg1)
493
- VALUE obj, arg1;
494
- {
495
- glutDetachMenu(NUM2INT(arg1));
496
- return Qnil;
497
- }
498
-
499
-
500
- /* GLUT sub-API. */
501
- static void GLUTCALLBACK glut_DisplayFuncCallback(void)
502
- {
503
- VALUE func;
504
- func = rb_ary_entry(DisplayFunc, glutGetWindow());
505
- if (!NIL_P(func))
506
- rb_funcall(func, callId, 0);
507
- }
508
-
509
-
510
- static void GLUTCALLBACK
511
- glut_ReshapeFuncCallback(width, height)
512
- int width, height;
513
- {
514
- VALUE func;
515
- func = rb_ary_entry( ReshapeFunc, glutGetWindow());
516
- if (!NIL_P(func))
517
- rb_funcall(func, callId, 2, INT2FIX(width), INT2FIX(height));
518
- }
519
-
520
-
521
- static void GLUTCALLBACK
522
- glut_KeyboardFuncCallback(key, x, y)
523
- unsigned char key;
524
- int x,y;
525
- {
526
- VALUE func;
527
- func = rb_ary_entry(KeyboardFunc, glutGetWindow());
528
- if (!NIL_P(func))
529
- #if RUBY_VERSION <190
530
- rb_funcall(func, callId, 3, INT2FIX(key), INT2FIX(x), INT2FIX(y));
531
- #else
532
- rb_funcall(func, callId, 3, rb_funcall(INT2FIX(key),rb_intern("chr"),0), INT2FIX(x), INT2FIX(y));
533
- #endif
534
- }
535
-
536
-
537
- static void GLUTCALLBACK
538
- glut_MouseFuncCallback(button, state, x, y)
539
- int button, state, x, y;
540
- {
541
- VALUE func;
542
- func = rb_ary_entry(MouseFunc, glutGetWindow());
543
- if (!NIL_P(func))
544
- rb_funcall(func, callId, 4, INT2FIX(button), INT2FIX(state), INT2FIX(x), INT2FIX(y));
545
- }
546
-
547
-
548
- static void GLUTCALLBACK
549
- glut_MotionFuncCallback(x, y)
550
- int x, y;
551
- {
552
- VALUE func;
553
- func = rb_ary_entry(MotionFunc, glutGetWindow());
554
- if (!NIL_P(func))
555
- rb_funcall(func, callId, 2,INT2FIX(x), INT2FIX(y));
556
- }
557
-
558
-
559
- static void GLUTCALLBACK
560
- glut_PassiveMotionFuncCallback(x, y)
561
- int x, y;
562
- {
563
- VALUE func;
564
- func = rb_ary_entry(PassiveMotionFunc, glutGetWindow());
565
- if (!NIL_P(func))
566
- rb_funcall(func, callId, 2,INT2FIX(x), INT2FIX(y));
567
- }
568
-
569
-
570
- static void GLUTCALLBACK
571
- glut_EntryFuncCallback(state)
572
- int state;
573
- {
574
- VALUE func;
575
- func = rb_ary_entry(EntryFunc,glutGetWindow());
576
- if (!NIL_P(func))
577
- rb_funcall(func, callId, 1, INT2NUM(state));
578
- }
579
-
580
-
581
- static void GLUTCALLBACK
582
- glut_VisibilityFuncCallback(state)
583
- int state;
584
- {
585
- VALUE func;
586
- func = rb_ary_entry(VisibilityFunc, glutGetWindow());
587
- if (!NIL_P(func))
588
- rb_funcall(func, callId, 1, INT2NUM(state));
589
- }
590
-
591
-
592
- static VALUE idle_func = Qnil;
593
- static void GLUTCALLBACK
594
- glut_IdleFuncCallback(void)
595
- {
596
- if (!NIL_P(idle_func))
597
- rb_funcall(idle_func, callId, 0);
598
- }
599
-
600
-
601
- static VALUE
602
- glut_IdleFunc(obj, arg1)
603
- VALUE obj,arg1;
604
- {
605
- if (!rb_obj_is_kind_of(arg1,rb_cProc) && !NIL_P(arg1))
606
- rb_raise(rb_eTypeError, "glutIdleFunc:%s", rb_class2name(CLASS_OF(arg1)));
607
- idle_func = arg1;
608
- if (NIL_P(arg1))
609
- glutIdleFunc(NULL);
610
- else
611
- glutIdleFunc(glut_IdleFuncCallback);
612
- return Qnil;
613
- }
614
-
615
-
616
- static VALUE timer_func = Qnil;
617
- static void GLUTCALLBACK
618
- glut_TimerFuncCallback(int value)
619
- {
620
- if (!NIL_P(timer_func))
621
- rb_funcall(timer_func, callId, 1, INT2NUM(value));
622
- }
623
-
624
-
625
- static VALUE
626
- glut_TimerFunc(obj, arg1, arg2, arg3)
627
- VALUE obj,arg1,arg2,arg3;
628
- {
629
- unsigned int millis;
630
- int value;
631
- millis = (unsigned int)NUM2INT(arg1);
632
- value = NUM2INT(arg3);
633
- if (!rb_obj_is_kind_of(arg2,rb_cProc))
634
- rb_raise(rb_eTypeError, "glutTimerFunc:%s", rb_class2name(CLASS_OF(arg2)));
635
- timer_func = arg2;
636
- glutTimerFunc(millis, glut_TimerFuncCallback, value);
637
- return Qnil;
638
- }
639
-
640
-
641
- static VALUE menustate_func = Qnil;
642
- static void GLUTCALLBACK
643
- glut_MenuStateFuncCallback(int state)
644
- {
645
- if (!NIL_P(menustate_func))
646
- rb_funcall(menustate_func, callId, 1, INT2NUM(state));
647
- }
648
-
649
-
650
- static VALUE
651
- glut_MenuStateFunc(obj, arg1)
652
- VALUE obj,arg1;
653
- {
654
- if (!rb_obj_is_kind_of(arg1,rb_cProc) && !(NIL_P(arg1)))
655
- rb_raise(rb_eTypeError, "glutMenuStateFunc:%s", rb_class2name(CLASS_OF(arg1)));
656
- menustate_func = arg1;
657
- if (NIL_P(arg1))
658
- glutMenuStateFunc(NULL);
659
- else
660
- glutMenuStateFunc(glut_MenuStateFuncCallback);
661
- return Qnil;
662
- }
663
-
664
- static VALUE menustatus_func = Qnil;
665
- static void GLUTCALLBACK
666
- glut_MenuStatusFuncCallback(int state,int x,int y)
667
- {
668
- if (!NIL_P(menustatus_func))
669
- rb_funcall(menustatus_func, callId, 3, INT2NUM(state),INT2NUM(x),INT2NUM(y));
670
- }
671
-
672
- static VALUE
673
- glut_MenuStatusFunc(obj, arg1)
674
- VALUE obj,arg1;
675
- {
676
- if (!rb_obj_is_kind_of(arg1,rb_cProc) && !(NIL_P(arg1)))
677
- rb_raise(rb_eTypeError, "glutMenuStatusFunc:%s", rb_class2name(CLASS_OF(arg1)));
678
- menustatus_func = arg1;
679
- if (NIL_P(arg1))
680
- glutMenuStatusFunc(NULL);
681
- else
682
- glutMenuStatusFunc(glut_MenuStatusFuncCallback);
683
- return Qnil;
684
- }
685
-
686
- static void GLUTCALLBACK
687
- glut_SpecialFuncCallback(key, x, y)
688
- int key, x, y;
689
- {
690
- VALUE func;
691
- func = rb_ary_entry(SpecialFunc, glutGetWindow());
692
- if (!NIL_P(func))
693
- rb_funcall(func, callId, 3,INT2NUM(key), INT2FIX(x), INT2FIX(y));
694
- }
695
-
696
-
697
- static void GLUTCALLBACK
698
- glut_SpaceballMotionFuncCallback(x, y, z)
699
- int x,y,z;
700
- {
701
- VALUE func;
702
- func = rb_ary_entry(SpaceballMotionFunc, glutGetWindow());
703
- if (!NIL_P(func))
704
- rb_funcall(func, callId, 3,INT2NUM(x), INT2FIX(y), INT2FIX(z));
705
- }
706
-
707
-
708
- static void GLUTCALLBACK
709
- glut_SpaceballRotateFuncCallback(x, y, z)
710
- int x,y,z;
711
- {
712
- VALUE func;
713
- func = rb_ary_entry(SpaceballRotateFunc, glutGetWindow());
714
- if (!NIL_P(func))
715
- rb_funcall(func, callId, 3,INT2NUM(x), INT2FIX(y), INT2FIX(z));
716
- }
717
-
718
-
719
- static void GLUTCALLBACK
720
- glut_SpaceballButtonFuncCallback(button, state)
721
- int button, state;
722
- {
723
- VALUE func;
724
- func = rb_ary_entry(SpaceballButtonFunc, glutGetWindow());
725
- if (!NIL_P(func))
726
- rb_funcall(func, callId, 2,INT2NUM(button), INT2NUM(state));
727
- }
728
-
729
-
730
- static void GLUTCALLBACK
731
- glut_ButtonBoxFuncCallback(button, state)
732
- int button, state;
733
- {
734
- VALUE func;
735
- func = rb_ary_entry(ButtonBoxFunc, glutGetWindow());
736
- if (!NIL_P(func))
737
- rb_funcall(func, callId, 2,INT2NUM(button), INT2NUM(state));
738
- }
739
-
740
-
741
- static void GLUTCALLBACK
742
- glut_DialsFuncCallback(dial, value)
743
- int dial, value;
744
- {
745
- VALUE func;
746
- func = rb_ary_entry(DialsFunc, glutGetWindow());
747
- if (!NIL_P(func))
748
- rb_funcall(func, callId, 2,INT2NUM(dial), INT2NUM(value));
749
- }
750
-
751
-
752
- static void GLUTCALLBACK
753
- glut_TabletMotionFuncCallback(x, y)
754
- int x, y;
755
- {
756
- VALUE func;
757
- func = rb_ary_entry(TabletMotionFunc, glutGetWindow());
758
- if (!NIL_P(func))
759
- rb_funcall(func, callId, 2,INT2NUM(x), INT2NUM(y));
760
- }
761
-
762
-
763
- static void GLUTCALLBACK
764
- glut_TabletButtonFuncCallback(button, state, x, y)
765
- int button, state, x, y;
766
- {
767
- VALUE func;
768
- func = rb_ary_entry(TabletButtonFunc, glutGetWindow());
769
- if (!NIL_P(func))
770
- rb_funcall(func, 4, INT2NUM(button), INT2NUM(state), INT2NUM(x), INT2NUM(y));
771
- }
772
-
773
-
774
- static void GLUTCALLBACK
775
- glut_OverlayDisplayFuncCallback()
776
- {
777
- VALUE func;
778
- func = rb_ary_entry(OverlayDisplayFunc, glutGetWindow());
779
- if (!NIL_P(func))
780
- rb_funcall(func, callId, 0);
781
- }
782
-
783
-
784
- static void GLUTCALLBACK
785
- glut_WindowStatusFuncCallback(state)
786
- int state;
787
- {
788
- VALUE func;
789
- func = rb_ary_entry(WindowStatusFunc, glutGetWindow());
790
- if (!NIL_P(func))
791
- rb_funcall(func, callId, 1, INT2NUM(state));
792
- }
793
-
794
-
795
- static void GLUTCALLBACK
796
- glut_JoystickFuncCallback(buttonMask,x,y,z)
797
- unsigned int buttonMask;
798
- int x,y,z;
799
- {
800
- VALUE func;
801
- func = rb_ary_entry(JoystickFunc, glutGetWindow());
802
- if (!NIL_P(func))
803
- rb_funcall(func, callId, 4, INT2NUM(buttonMask),INT2NUM(x),INT2NUM(y),INT2NUM(z));
804
- }
805
-
806
- static void GLUTCALLBACK
807
- glut_KeyboardUpFuncCallback(key,x,y)
808
- unsigned char key;
809
- int x,y;
810
- {
811
- VALUE func;
812
- func = rb_ary_entry(KeyboardUpFunc, glutGetWindow());
813
- if (!NIL_P(func))
814
- rb_funcall(func, callId, 3, INT2NUM(key),INT2NUM(x),INT2NUM(y));
815
- }
816
-
817
- static void GLUTCALLBACK
818
- glut_SpecialUpFuncCallback(key,x,y)
819
- int key;
820
- int x,y;
821
- {
822
- VALUE func;
823
- func = rb_ary_entry(SpecialUpFunc, glutGetWindow());
824
- if (!NIL_P(func))
825
- rb_funcall(func, callId, 3, INT2NUM(key),INT2NUM(x),INT2NUM(y));
826
- }
827
-
828
-
829
- /* GLUT color index sub-API. */
830
- static VALUE
831
- glut_SetColor(obj,arg1,arg2,arg3,arg4)
832
- VALUE obj,arg1,arg2,arg3,arg4;
833
- {
834
- int set;
835
- GLfloat red;
836
- GLfloat green;
837
- GLfloat blue;
838
- set = NUM2INT(arg1);
839
- red = (GLfloat)NUM2DBL(arg2);
840
- green = (GLfloat)NUM2DBL(arg3);
841
- blue = (GLfloat)NUM2DBL(arg4);
842
- glutSetColor(set, red, green, blue);
843
- return Qnil;
844
- }
845
-
846
-
847
- static VALUE
848
- glut_GetColor(obj,arg1,arg2)
849
- VALUE obj,arg1,arg2;
850
- {
851
- int ndx;
852
- int component;
853
- GLfloat ret;
854
- ndx = NUM2INT(arg1);
855
- component = NUM2INT(arg2);
856
- ret = (GLfloat)glutGetColor(ndx, component);
857
- return rb_float_new(ret);
858
- }
859
-
860
-
861
- static VALUE
862
- glut_CopyColormap(obj,arg1)
863
- VALUE obj,arg1;
864
- {
865
- int win;
866
- win = NUM2INT(arg1);
867
- glutCopyColormap(win);
868
- return Qnil;
869
- }
870
-
871
-
872
- /* GLUT state retrieval sub-API. */
873
- static VALUE
874
- glut_Get(obj,arg1)
875
- VALUE obj,arg1;
876
- {
877
- GLenum type;
878
- int ret;
879
- type = (GLenum)NUM2INT(arg1);
880
- ret = glutGet(type);
881
- return INT2NUM(ret);
882
- }
883
-
884
-
885
- static VALUE
886
- glut_DeviceGet(obj,arg1)
887
- VALUE obj,arg1;
888
- {
889
- GLenum type;
890
- int ret;
891
- type = (GLenum)NUM2INT(arg1);
892
- ret = glutDeviceGet(type);
893
- return INT2NUM(ret);
894
- }
895
-
896
-
897
- /* GLUT extension support sub-API */
898
- static VALUE
899
- glut_ExtensionSupported(obj,arg1)
900
- VALUE obj,arg1;
901
- {
902
- int ret;
903
- Check_Type(arg1,T_STRING);
904
- ret = glutExtensionSupported(RSTRING_PTR(arg1));
905
- return INT2NUM(ret);
906
- }
907
-
908
- static VALUE
909
- glut_GetModifiers(obj)
910
- VALUE obj;
911
- {
912
- int ret;
913
- ret = glutGetModifiers();
914
- return INT2NUM(ret);
915
- }
916
-
917
-
918
- static VALUE
919
- glut_LayerGet(obj,arg1)
920
- VALUE obj,arg1;
921
- {
922
- GLenum type;
923
- int ret;
924
- type = (GLenum)NUM2INT(arg1);
925
- ret = glutLayerGet(type);
926
- return INT2NUM(ret);
927
- }
928
-
929
- /* GLUT font sub-API */
930
-
931
- /* Some glut implementations define font enums as addresses of local functions
932
- which are then called by glut internally. This may lead to crashes or bus errors
933
- on some platforms, so to be safe we hardcode the values passed to/from ruby */
934
-
935
- static inline void * bitmap_font_map(int f)
936
- {
937
- switch (f) {
938
- case 0: return (void *)GLUT_BITMAP_9_BY_15;
939
- case 1: return (void *)GLUT_BITMAP_8_BY_13;
940
- case 2: return (void *)GLUT_BITMAP_TIMES_ROMAN_10;
941
- case 3: return (void *)GLUT_BITMAP_TIMES_ROMAN_24;
942
- case 4: return (void *)GLUT_BITMAP_HELVETICA_10;
943
- case 5: return (void *)GLUT_BITMAP_HELVETICA_12;
944
- case 6: return (void *)GLUT_BITMAP_HELVETICA_18;
945
- default:
946
- rb_raise(rb_eArgError, "Unsupported font");
947
- }
948
-
949
- return (void *) 0; /* not reached */
950
- }
951
-
952
- static inline void * stroke_font_map(int f)
953
- {
954
- switch (f) {
955
- case 7: return (void *)GLUT_STROKE_ROMAN;
956
- case 8: return (void *)GLUT_STROKE_MONO_ROMAN;
957
- default:
958
- rb_raise(rb_eArgError, "Unsupported font");
959
- }
960
-
961
- return (void *) 0; /* not reached */
962
- }
963
-
964
- static VALUE
965
- glut_BitmapCharacter(obj,arg1,arg2)
966
- VALUE obj,arg1,arg2;
967
- {
968
- int character;
969
- int font;
970
- font = NUM2INT(arg1);
971
- character = NUM2INT(arg2);
972
- glutBitmapCharacter(bitmap_font_map(font),character);
973
- return Qnil;
974
- }
975
-
976
- static VALUE
977
- glut_BitmapWidth(obj,arg1,arg2)
978
- VALUE obj,arg1,arg2;
979
- {
980
- int font;
981
- int character;
982
- int ret;
983
- font = NUM2INT(arg1);
984
- character = NUM2INT(arg2);
985
- ret = glutBitmapWidth(bitmap_font_map(font), character);
986
- return INT2NUM(ret);
987
- }
988
-
989
-
990
- static VALUE
991
- glut_StrokeCharacter(obj,arg1,arg2)
992
- VALUE obj,arg1,arg2;
993
- {
994
- int font;
995
- int character;
996
- font = NUM2INT(arg1);
997
- character = NUM2INT(arg2);
998
- glutStrokeCharacter(stroke_font_map(font), character);
999
- return Qnil;
1000
- }
1001
-
1002
-
1003
- static VALUE
1004
- glut_StrokeWidth(obj,arg1,arg2)
1005
- VALUE obj,arg1,arg2;
1006
- {
1007
- int font;
1008
- int character;
1009
- int ret;
1010
- font = NUM2INT(arg1);
1011
- character = NUM2INT(arg2);
1012
- ret = glutStrokeWidth(stroke_font_map(font), character);
1013
- return INT2NUM(ret);
1014
- }
1015
-
1016
-
1017
- static VALUE
1018
- glut_BitmapLength(obj,arg1,arg2)
1019
- VALUE obj,arg1,arg2;
1020
- {
1021
- int font;
1022
- int ret;
1023
- Check_Type(arg2,T_STRING);
1024
- font = NUM2INT(arg1);
1025
- ret = glutBitmapLength(bitmap_font_map(font), (const unsigned char*)RSTRING_PTR(arg2));
1026
- return INT2NUM(ret);
1027
- }
1028
-
1029
-
1030
- static VALUE
1031
- glut_StrokeLength(obj,arg1,arg2)
1032
- VALUE obj,arg1,arg2;
1033
- {
1034
- int font;
1035
- int ret;
1036
- Check_Type(arg2,T_STRING);
1037
- font = NUM2INT(arg1);
1038
- ret = glutStrokeLength(stroke_font_map(font), (const unsigned char*)RSTRING_PTR(arg2));
1039
- return INT2NUM(ret);
1040
- }
1041
-
1042
- /* GLUT pre-built models sub-API */
1043
- static VALUE
1044
- glut_WireSphere(obj,arg1,arg2,arg3)
1045
- VALUE obj,arg1,arg2,arg3;
1046
- {
1047
- GLdouble radius;
1048
- GLint slices;
1049
- GLint stacks;
1050
- radius = (GLdouble)NUM2DBL(arg1);
1051
- slices = (GLint)NUM2INT(arg2);
1052
- stacks = (GLint)NUM2INT(arg3);
1053
- glutWireSphere(radius, slices, stacks);
1054
- return Qnil;
1055
- }
1056
-
1057
-
1058
- static VALUE
1059
- glut_SolidSphere(obj,arg1,arg2,arg3)
1060
- VALUE obj,arg1,arg2,arg3;
1061
- {
1062
- GLdouble radius;
1063
- GLint slices;
1064
- GLint stacks;
1065
- radius = (GLdouble)NUM2DBL(arg1);
1066
- slices = (GLint)NUM2INT(arg2);
1067
- stacks = (GLint)NUM2INT(arg3);
1068
- glutSolidSphere(radius, slices, stacks);
1069
- return Qnil;
1070
- }
1071
-
1072
-
1073
- static VALUE
1074
- glut_WireCone(obj,arg1,arg2,arg3,arg4)
1075
- VALUE obj,arg1,arg2,arg3,arg4;
1076
- {
1077
- GLdouble base;
1078
- GLdouble height;
1079
- GLint slices;
1080
- GLint stacks;
1081
- base = (GLdouble)NUM2DBL(arg1);
1082
- height = (GLdouble)NUM2DBL(arg2);
1083
- slices = (GLint)NUM2INT(arg3);
1084
- stacks = (GLint)NUM2INT(arg4);
1085
- glutWireCone(base, height, slices, stacks);
1086
- return Qnil;
1087
- }
1088
-
1089
-
1090
- static VALUE
1091
- glut_SolidCone(obj,arg1,arg2,arg3,arg4)
1092
- VALUE obj,arg1,arg2,arg3,arg4;
1093
- {
1094
- GLdouble base;
1095
- GLdouble height;
1096
- GLint slices;
1097
- GLint stacks;
1098
- base = (GLdouble)NUM2DBL(arg1);
1099
- height = (GLdouble)NUM2DBL(arg2);
1100
- slices = (GLint)NUM2INT(arg3);
1101
- stacks = (GLint)NUM2INT(arg4);
1102
- glutSolidCone(base, height, slices, stacks);
1103
- return Qnil;
1104
- }
1105
-
1106
-
1107
- static VALUE
1108
- glut_WireCube(obj,arg1)
1109
- VALUE obj,arg1;
1110
- {
1111
- GLdouble size;
1112
- size = (GLdouble)NUM2DBL(arg1);
1113
- glutWireCube(size);
1114
- return Qnil;
1115
- }
1116
-
1117
-
1118
- static VALUE
1119
- glut_SolidCube(obj,arg1)
1120
- VALUE obj,arg1;
1121
- {
1122
- GLdouble size;
1123
- size = (GLdouble)NUM2DBL(arg1);
1124
- glutSolidCube(size);
1125
- return Qnil;
1126
- }
1127
-
1128
-
1129
- static VALUE
1130
- glut_WireTorus(obj,arg1,arg2,arg3,arg4)
1131
- VALUE obj,arg1,arg2,arg3,arg4;
1132
- {
1133
- GLdouble innerRadius;
1134
- GLdouble outerRadius;
1135
- GLint sides;
1136
- GLint rings;
1137
- innerRadius = (GLdouble)NUM2DBL(arg1);
1138
- outerRadius = (GLdouble)NUM2DBL(arg2);
1139
- sides = (GLint)NUM2INT(arg3);
1140
- rings = (GLint)NUM2INT(arg4);
1141
- glutWireTorus(innerRadius, outerRadius, sides, rings);
1142
- return Qnil;
1143
- }
1144
-
1145
-
1146
- static VALUE
1147
- glut_SolidTorus(obj,arg1,arg2,arg3,arg4)
1148
- VALUE obj,arg1,arg2,arg3,arg4;
1149
- {
1150
- GLdouble innerRadius;
1151
- GLdouble outerRadius;
1152
- GLint sides;
1153
- GLint rings;
1154
- innerRadius = (GLdouble)NUM2DBL(arg1);
1155
- outerRadius = (GLdouble)NUM2DBL(arg2);
1156
- sides = (GLint)NUM2INT(arg3);
1157
- rings = (GLint)NUM2INT(arg4);
1158
- glutSolidTorus(innerRadius, outerRadius, sides, rings);
1159
- return Qnil;
1160
- }
1161
-
1162
-
1163
- GLUT_SIMPLE_FUNCTION(WireDodecahedron)
1164
- GLUT_SIMPLE_FUNCTION(SolidDodecahedron)
1165
- GLUT_SIMPLE_FUNCTION(WireOctahedron)
1166
- GLUT_SIMPLE_FUNCTION(SolidOctahedron)
1167
- GLUT_SIMPLE_FUNCTION(WireTetrahedron)
1168
- GLUT_SIMPLE_FUNCTION(SolidTetrahedron)
1169
- GLUT_SIMPLE_FUNCTION(WireIcosahedron)
1170
- GLUT_SIMPLE_FUNCTION(SolidIcosahedron)
1171
-
1172
- static VALUE
1173
- glut_WireTeapot(obj,arg1)
1174
- VALUE obj,arg1;
1175
- {
1176
- GLdouble size;
1177
- size = (GLdouble)NUM2DBL(arg1);
1178
- glutWireTeapot(size);
1179
- return Qnil;
1180
- }
1181
-
1182
-
1183
- static VALUE
1184
- glut_SolidTeapot(obj,arg1)
1185
- VALUE obj,arg1;
1186
- {
1187
- GLdouble size;
1188
- size = (GLdouble)NUM2DBL(arg1);
1189
- glutSolidTeapot(size);
1190
- return Qnil;
1191
- }
1192
-
1193
- /* GLUT video resize sub-API. */
1194
- static VALUE
1195
- glut_VideoResizeGet(obj,arg1)
1196
- VALUE obj,arg1;
1197
- {
1198
- GLenum param;
1199
- int ret;
1200
- param = (GLenum)NUM2INT(arg1);
1201
- ret = glutVideoResizeGet(param);
1202
- return INT2NUM(ret);
1203
- }
1204
-
1205
-
1206
- GLUT_SIMPLE_FUNCTION(SetupVideoResizing)
1207
- GLUT_SIMPLE_FUNCTION(StopVideoResizing)
1208
-
1209
- static VALUE
1210
- glut_VideoResize(obj,arg1,arg2,arg3,arg4)
1211
- VALUE obj,arg1,arg2,arg3,arg4;
1212
- {
1213
- int x;
1214
- int y;
1215
- int width;
1216
- int height;
1217
- x = NUM2INT(arg1);
1218
- y = NUM2INT(arg2);
1219
- width = NUM2INT(arg3);
1220
- height = NUM2INT(arg4);
1221
- glutVideoResize(x,y, width, height);
1222
- return Qnil;
1223
- }
1224
-
1225
- static VALUE
1226
- glut_VideoPan(obj,arg1,arg2,arg3,arg4)
1227
- VALUE obj,arg1,arg2,arg3,arg4;
1228
- {
1229
- int x;
1230
- int y;
1231
- int width;
1232
- int height;
1233
- x = NUM2INT(arg1);
1234
- y = NUM2INT(arg2);
1235
- width = NUM2INT(arg3);
1236
- height = NUM2INT(arg4);
1237
- glutVideoPan(x,y, width, height);
1238
- return Qnil;
1239
- }
1240
-
1241
- /* GLUT debugging sub-API. */
1242
- GLUT_SIMPLE_FUNCTION(ReportErrors)
1243
-
1244
- static VALUE
1245
- glut_GameModeString(obj,arg1)
1246
- VALUE obj,arg1;
1247
- {
1248
- Check_Type(arg1,T_STRING);
1249
- glutGameModeString((const char*)RSTRING_PTR(arg1));
1250
- return Qnil;
1251
- }
1252
-
1253
- GLUT_SIMPLE_FUNCTION(EnterGameMode)
1254
- GLUT_SIMPLE_FUNCTION(LeaveGameMode)
1255
-
1256
- GLUT_SIMPLE_FUNCTION(ForceJoystickFunc)
1257
-
1258
- static VALUE
1259
- glut_GameModeGet(obj,arg1)
1260
- VALUE obj,arg1;
1261
- {
1262
- GLenum info;
1263
- int i;
1264
- info = (GLenum)NUM2INT(arg1);
1265
- i = glutGameModeGet(info);
1266
- return INT2NUM(i);
1267
- }
1268
-
1269
- static VALUE
1270
- glut_SetKeyRepeat(obj,arg1)
1271
- VALUE obj,arg1;
1272
- {
1273
- GLenum repeatMode;
1274
- repeatMode = (int) NUM2INT(arg1);
1275
- glutSetKeyRepeat(repeatMode);
1276
- return Qnil;
1277
- }
1278
-
1279
- static VALUE
1280
- glut_IgnoreKeyRepeat(obj,arg1)
1281
- VALUE obj,arg1;
1282
- {
1283
- GLenum ignore;
1284
- ignore = (int) NUM2INT(arg1);
1285
- glutIgnoreKeyRepeat(ignore);
1286
- return Qnil;
1287
- }
1288
-
1289
- static VALUE
1290
- glut_PostWindowOverlayRedisplay(obj,arg1)
1291
- VALUE obj,arg1;
1292
- {
1293
- int win;
1294
- win = (int) NUM2INT(arg1);
1295
- glutPostWindowOverlayRedisplay(win);
1296
- return Qnil;
1297
- }
1298
-
1299
- static VALUE
1300
- glut_PostWindowRedisplay(obj,arg1)
1301
- VALUE obj,arg1;
1302
- {
1303
- int win;
1304
- win = (int) NUM2INT(arg1);
1305
- glutPostWindowRedisplay(win);
1306
- return Qnil;
1307
- }
1308
-
1309
- static VALUE module;
1310
-
1311
- DLLEXPORT void Init_glut()
1312
- {
1313
- module = rb_define_module("Glut");
1314
-
1315
- rb_global_variable( &g_menucallback );
1316
- g_menucallback = rb_ary_new();
1317
-
1318
- rb_define_module_function(module, "glutInit", glut_Init, -1);
1319
- rb_define_module_function(module, "glutInitDisplayMode", glut_InitDisplayMode, 1);
1320
- rb_define_module_function(module, "glutInitDisplayString", glut_InitDisplayString, 1);
1321
- rb_define_module_function(module, "glutInitWindowPosition", glut_InitWindowPosition, 2);
1322
- rb_define_module_function(module, "glutInitWindowSize", glut_InitWindowSize, 2);
1323
- rb_define_module_function(module, "glutMainLoop", glut_MainLoop, 0);
1324
- rb_define_module_function(module, "glutCheckLoop", glut_MainLoop, 0);
1325
- rb_define_module_function(module, "glutGameModeString", glut_GameModeString, 1);
1326
- rb_define_module_function(module, "glutEnterGameMode", glut_EnterGameMode, 0);
1327
- rb_define_module_function(module, "glutLeaveGameMode", glut_LeaveGameMode, 0);
1328
- rb_define_module_function(module, "glutCreateWindow", glut_CreateWindow, -1);
1329
- rb_define_module_function(module, "glutCreateSubWindow", glut_CreateSubWindow, 5);
1330
- rb_define_module_function(module, "glutDestroyWindow", glut_DestroyWindow, 1);
1331
- rb_define_module_function(module, "glutPostRedisplay", glut_PostRedisplay, 0);
1332
- rb_define_module_function(module, "glutSwapBuffers", glut_SwapBuffers, 0);
1333
- rb_define_module_function(module, "glutGetWindow", glut_GetWindow, 0);
1334
- rb_define_module_function(module, "glutSetWindow", glut_SetWindow, 1);
1335
- rb_define_module_function(module, "glutSetWindowTitle", glut_SetWindowTitle, 1);
1336
- rb_define_module_function(module, "glutSetIconTitle", glut_SetIconTitle, 1);
1337
- rb_define_module_function(module, "glutPositionWindow", glut_PositionWindow, 2);
1338
- rb_define_module_function(module, "glutReshapeWindow", glut_ReshapeWindow, 2);
1339
- rb_define_module_function(module, "glutPopWindow", glut_PopWindow, 0);
1340
- rb_define_module_function(module, "glutPushWindow", glut_PushWindow, 0);
1341
- rb_define_module_function(module, "glutIconifyWindow", glut_IconifyWindow, 0);
1342
- rb_define_module_function(module, "glutShowWindow", glut_ShowWindow, 0);
1343
- rb_define_module_function(module, "glutHideWindow", glut_HideWindow, 0);
1344
- rb_define_module_function(module, "glutFullScreen", glut_FullScreen, 0);
1345
- rb_define_module_function(module, "glutSetCursor", glut_SetCursor, 1);
1346
- rb_define_module_function(module, "glutWarpPointer", glut_WarpPointer, 2);
1347
- rb_define_module_function(module, "glutEstablishOverlay", glut_EstablishOverlay, 0);
1348
- rb_define_module_function(module, "glutRemoveOverlay", glut_RemoveOverlay, 0);
1349
- rb_define_module_function(module, "glutUseLayer", glut_UseLayer, 1);
1350
- rb_define_module_function(module, "glutPostOverlayRedisplay", glut_PostOverlayRedisplay, 0);
1351
- rb_define_module_function(module, "glutShowOverlay", glut_ShowOverlay, 0);
1352
- rb_define_module_function(module, "glutHideOverlay", glut_HideOverlay, 0);
1353
- rb_define_module_function(module, "glutCreateMenu", glut_CreateMenu, 1);
1354
- rb_define_module_function(module, "glutDestroyMenu", glut_DestroyMenu, 1);
1355
- rb_define_module_function(module, "glutGetMenu", glut_GetMenu, 0);
1356
- rb_define_module_function(module, "glutSetMenu", glut_SetMenu, 1);
1357
- rb_define_module_function(module, "glutAddMenuEntry", glut_AddMenuEntry, 2);
1358
- rb_define_module_function(module, "glutAddSubMenu", glut_AddSubMenu, 2);
1359
- rb_define_module_function(module, "glutChangeToMenuEntry", glut_ChangeToMenuEntry, 3);
1360
- rb_define_module_function(module, "glutChangeToSubMenu", glut_ChangeToSubMenu, 3);
1361
- rb_define_module_function(module, "glutRemoveMenuItem", glut_RemoveMenuItem, 1);
1362
- rb_define_module_function(module, "glutAttachMenu", glut_AttachMenu, 1);
1363
- rb_define_module_function(module, "glutDetachMenu", glut_DetachMenu, 1);
1364
- rb_define_module_function(module, "glutSetColor", glut_SetColor, 4);
1365
- rb_define_module_function(module, "glutGetColor", glut_GetColor, 2);
1366
- rb_define_module_function(module, "glutCopyColormap", glut_CopyColormap, 1);
1367
- rb_define_module_function(module, "glutGet", glut_Get, 1);
1368
- rb_define_module_function(module, "glutDeviceGet", glut_DeviceGet, 1);
1369
- rb_define_module_function(module, "glutExtensionSupported", glut_ExtensionSupported, 1);
1370
- rb_define_module_function(module, "glutGetModifiers", glut_GetModifiers, 0);
1371
- rb_define_module_function(module, "glutLayerGet", glut_LayerGet, 1);
1372
- rb_define_module_function(module, "glutBitmapCharacter", glut_BitmapCharacter, 2);
1373
- rb_define_module_function(module, "glutBitmapWidth", glut_BitmapWidth, 2);
1374
- rb_define_module_function(module, "glutStrokeCharacter", glut_StrokeCharacter, 2);
1375
- rb_define_module_function(module, "glutStrokeWidth", glut_StrokeWidth, 2);
1376
- rb_define_module_function(module, "glutBitmapLength", glut_BitmapLength, 2);
1377
- rb_define_module_function(module, "glutStrokeLength", glut_StrokeLength, 2);
1378
- rb_define_module_function(module, "glutWireSphere", glut_WireSphere, 3);
1379
- rb_define_module_function(module, "glutSolidSphere", glut_SolidSphere, 3);
1380
- rb_define_module_function(module, "glutWireCone", glut_WireCone, 4);
1381
- rb_define_module_function(module, "glutSolidCone", glut_SolidCone, 4);
1382
- rb_define_module_function(module, "glutWireCube", glut_WireCube, 1);
1383
- rb_define_module_function(module, "glutSolidCube", glut_SolidCube, 1);
1384
- rb_define_module_function(module, "glutWireTorus", glut_WireTorus, 4);
1385
- rb_define_module_function(module, "glutSolidTorus", glut_SolidTorus, 4);
1386
- rb_define_module_function(module, "glutWireDodecahedron", glut_WireDodecahedron, 0);
1387
- rb_define_module_function(module, "glutSolidDodecahedron", glut_SolidDodecahedron, 0);
1388
- rb_define_module_function(module, "glutWireTeapot", glut_WireTeapot, 1);
1389
- rb_define_module_function(module, "glutSolidTeapot", glut_SolidTeapot, 1);
1390
- rb_define_module_function(module, "glutWireOctahedron", glut_WireOctahedron, 0);
1391
- rb_define_module_function(module, "glutSolidOctahedron", glut_SolidOctahedron, 0);
1392
- rb_define_module_function(module, "glutWireTetrahedron", glut_WireTetrahedron, 0);
1393
- rb_define_module_function(module, "glutSolidTetrahedron", glut_SolidTetrahedron, 0);
1394
- rb_define_module_function(module, "glutWireIcosahedron", glut_WireIcosahedron, 0);
1395
- rb_define_module_function(module, "glutSolidIcosahedron", glut_SolidIcosahedron, 0);
1396
- rb_define_module_function(module, "glutVideoResizeGet", glut_VideoResizeGet, 1);
1397
- rb_define_module_function(module, "glutSetupVideoResizing", glut_SetupVideoResizing, 0);
1398
- rb_define_module_function(module, "glutStopVideoResizing", glut_StopVideoResizing, 0);
1399
- rb_define_module_function(module, "glutVideoResize", glut_VideoResize, 4);
1400
- rb_define_module_function(module, "glutVideoPan", glut_VideoPan, 4);
1401
- rb_define_module_function(module, "glutReportErrors", glut_ReportErrors, 0);
1402
- rb_define_module_function(module, "glutIdleFunc", glut_IdleFunc, 1);
1403
- rb_define_module_function(module, "glutTimerFunc", glut_TimerFunc, 3);
1404
- rb_define_module_function(module, "glutMenuStateFunc", glut_MenuStateFunc, 1);
1405
- rb_define_module_function(module, "glutMenuStatusFunc", glut_MenuStatusFunc, 1);
1406
- rb_define_module_function(module, "glutForceJoystickFunc", glut_ForceJoystickFunc, 0);
1407
- rb_define_module_function(module, "glutGameModeGet", glut_GameModeGet, 1);
1408
- rb_define_module_function(module, "glutSetKeyRepeat", glut_SetKeyRepeat, 1);
1409
- rb_define_module_function(module, "glutIgnoreKeyRepeat", glut_IgnoreKeyRepeat, 1);
1410
- rb_define_module_function(module, "glutPostWindowOverlayRedisplay", glut_PostWindowOverlayRedisplay, 1);
1411
- rb_define_module_function(module, "glutPostWindowRedisplay", glut_PostWindowRedisplay, 1);
1412
-
1413
- rb_define_const(module, "GLUT_API_VERSION", INT2NUM(GLUT_API_VERSION));
1414
- rb_define_const(module, "GLUT_XLIB_IMPLEMENTATION", INT2NUM(GLUT_XLIB_IMPLEMENTATION));
1415
- rb_define_const(module, "GLUT_RGB", INT2NUM(GLUT_RGB));
1416
- rb_define_const(module, "GLUT_RGBA", INT2NUM(GLUT_RGBA));
1417
- rb_define_const(module, "GLUT_INDEX", INT2NUM(GLUT_INDEX));
1418
- rb_define_const(module, "GLUT_SINGLE", INT2NUM(GLUT_SINGLE));
1419
- rb_define_const(module, "GLUT_DOUBLE", INT2NUM(GLUT_DOUBLE));
1420
- rb_define_const(module, "GLUT_ACCUM", INT2NUM(GLUT_ACCUM));
1421
- rb_define_const(module, "GLUT_ALPHA", INT2NUM(GLUT_ALPHA));
1422
- rb_define_const(module, "GLUT_DEPTH", INT2NUM(GLUT_DEPTH));
1423
- rb_define_const(module, "GLUT_STENCIL", INT2NUM(GLUT_STENCIL));
1424
- rb_define_const(module, "GLUT_MULTISAMPLE", INT2NUM(GLUT_MULTISAMPLE));
1425
- rb_define_const(module, "GLUT_STEREO", INT2NUM(GLUT_STEREO));
1426
- rb_define_const(module, "GLUT_LUMINANCE", INT2NUM(GLUT_LUMINANCE));
1427
- rb_define_const(module, "GLUT_LEFT_BUTTON", INT2NUM(GLUT_LEFT_BUTTON));
1428
- rb_define_const(module, "GLUT_MIDDLE_BUTTON", INT2NUM(GLUT_MIDDLE_BUTTON));
1429
- rb_define_const(module, "GLUT_RIGHT_BUTTON", INT2NUM(GLUT_RIGHT_BUTTON));
1430
- rb_define_const(module, "GLUT_DOWN", INT2NUM(GLUT_DOWN));
1431
- rb_define_const(module, "GLUT_UP", INT2NUM(GLUT_UP));
1432
- rb_define_const(module, "GLUT_KEY_F1", INT2NUM(GLUT_KEY_F1));
1433
- rb_define_const(module, "GLUT_KEY_F2", INT2NUM(GLUT_KEY_F2));
1434
- rb_define_const(module, "GLUT_KEY_F3", INT2NUM(GLUT_KEY_F3));
1435
- rb_define_const(module, "GLUT_KEY_F4", INT2NUM(GLUT_KEY_F4));
1436
- rb_define_const(module, "GLUT_KEY_F5", INT2NUM(GLUT_KEY_F5));
1437
- rb_define_const(module, "GLUT_KEY_F6", INT2NUM(GLUT_KEY_F6));
1438
- rb_define_const(module, "GLUT_KEY_F7", INT2NUM(GLUT_KEY_F7));
1439
- rb_define_const(module, "GLUT_KEY_F8", INT2NUM(GLUT_KEY_F8));
1440
- rb_define_const(module, "GLUT_KEY_F9", INT2NUM(GLUT_KEY_F9));
1441
- rb_define_const(module, "GLUT_KEY_F10", INT2NUM(GLUT_KEY_F10));
1442
- rb_define_const(module, "GLUT_KEY_F11", INT2NUM(GLUT_KEY_F11));
1443
- rb_define_const(module, "GLUT_KEY_F12", INT2NUM(GLUT_KEY_F12));
1444
- rb_define_const(module, "GLUT_KEY_LEFT", INT2NUM(GLUT_KEY_LEFT));
1445
- rb_define_const(module, "GLUT_KEY_UP", INT2NUM(GLUT_KEY_UP));
1446
- rb_define_const(module, "GLUT_KEY_RIGHT", INT2NUM(GLUT_KEY_RIGHT));
1447
- rb_define_const(module, "GLUT_KEY_DOWN", INT2NUM(GLUT_KEY_DOWN));
1448
- rb_define_const(module, "GLUT_KEY_PAGE_UP", INT2NUM(GLUT_KEY_PAGE_UP));
1449
- rb_define_const(module, "GLUT_KEY_PAGE_DOWN", INT2NUM(GLUT_KEY_PAGE_DOWN));
1450
- rb_define_const(module, "GLUT_KEY_HOME", INT2NUM(GLUT_KEY_HOME));
1451
- rb_define_const(module, "GLUT_KEY_END", INT2NUM(GLUT_KEY_END));
1452
- rb_define_const(module, "GLUT_KEY_INSERT", INT2NUM(GLUT_KEY_INSERT));
1453
- rb_define_const(module, "GLUT_LEFT", INT2NUM(GLUT_LEFT));
1454
- rb_define_const(module, "GLUT_ENTERED", INT2NUM(GLUT_ENTERED));
1455
- rb_define_const(module, "GLUT_MENU_NOT_IN_USE", INT2NUM(GLUT_MENU_NOT_IN_USE));
1456
- rb_define_const(module, "GLUT_MENU_IN_USE", INT2NUM(GLUT_MENU_IN_USE));
1457
- rb_define_const(module, "GLUT_NOT_VISIBLE", INT2NUM(GLUT_NOT_VISIBLE));
1458
- rb_define_const(module, "GLUT_VISIBLE", INT2NUM(GLUT_VISIBLE));
1459
- rb_define_const(module, "GLUT_HIDDEN", INT2NUM(GLUT_HIDDEN));
1460
- rb_define_const(module, "GLUT_FULLY_RETAINED", INT2NUM(GLUT_FULLY_RETAINED));
1461
- rb_define_const(module, "GLUT_PARTIALLY_RETAINED", INT2NUM(GLUT_PARTIALLY_RETAINED));
1462
- rb_define_const(module, "GLUT_FULLY_COVERED", INT2NUM(GLUT_FULLY_COVERED));
1463
- rb_define_const(module, "GLUT_RED", INT2NUM(GLUT_RED));
1464
- rb_define_const(module, "GLUT_GREEN", INT2NUM(GLUT_GREEN));
1465
- rb_define_const(module, "GLUT_BLUE", INT2NUM(GLUT_BLUE));
1466
- rb_define_const(module, "GLUT_WINDOW_X", INT2NUM(GLUT_WINDOW_X));
1467
- rb_define_const(module, "GLUT_WINDOW_Y", INT2NUM(GLUT_WINDOW_Y));
1468
- rb_define_const(module, "GLUT_WINDOW_WIDTH", INT2NUM(GLUT_WINDOW_WIDTH));
1469
- rb_define_const(module, "GLUT_WINDOW_HEIGHT", INT2NUM(GLUT_WINDOW_HEIGHT));
1470
- rb_define_const(module, "GLUT_WINDOW_BUFFER_SIZE", INT2NUM(GLUT_WINDOW_BUFFER_SIZE));
1471
- rb_define_const(module, "GLUT_WINDOW_STENCIL_SIZE", INT2NUM(GLUT_WINDOW_STENCIL_SIZE));
1472
- rb_define_const(module, "GLUT_WINDOW_DEPTH_SIZE", INT2NUM(GLUT_WINDOW_DEPTH_SIZE));
1473
- rb_define_const(module, "GLUT_WINDOW_RED_SIZE", INT2NUM(GLUT_WINDOW_RED_SIZE));
1474
- rb_define_const(module, "GLUT_WINDOW_GREEN_SIZE", INT2NUM(GLUT_WINDOW_GREEN_SIZE));
1475
- rb_define_const(module, "GLUT_WINDOW_BLUE_SIZE", INT2NUM(GLUT_WINDOW_BLUE_SIZE));
1476
- rb_define_const(module, "GLUT_WINDOW_ALPHA_SIZE", INT2NUM(GLUT_WINDOW_ALPHA_SIZE));
1477
- rb_define_const(module, "GLUT_WINDOW_ACCUM_RED_SIZE", INT2NUM(GLUT_WINDOW_ACCUM_RED_SIZE));
1478
- rb_define_const(module, "GLUT_WINDOW_ACCUM_GREEN_SIZE", INT2NUM(GLUT_WINDOW_ACCUM_GREEN_SIZE));
1479
- rb_define_const(module, "GLUT_WINDOW_ACCUM_BLUE_SIZE", INT2NUM(GLUT_WINDOW_ACCUM_BLUE_SIZE));
1480
- rb_define_const(module, "GLUT_WINDOW_ACCUM_ALPHA_SIZE", INT2NUM(GLUT_WINDOW_ACCUM_ALPHA_SIZE));
1481
- rb_define_const(module, "GLUT_WINDOW_DOUBLEBUFFER", INT2NUM(GLUT_WINDOW_DOUBLEBUFFER));
1482
- rb_define_const(module, "GLUT_WINDOW_RGBA", INT2NUM(GLUT_WINDOW_RGBA));
1483
- rb_define_const(module, "GLUT_WINDOW_PARENT", INT2NUM(GLUT_WINDOW_PARENT));
1484
- rb_define_const(module, "GLUT_WINDOW_NUM_CHILDREN", INT2NUM(GLUT_WINDOW_NUM_CHILDREN));
1485
- rb_define_const(module, "GLUT_WINDOW_COLORMAP_SIZE", INT2NUM(GLUT_WINDOW_COLORMAP_SIZE));
1486
- rb_define_const(module, "GLUT_WINDOW_NUM_SAMPLES", INT2NUM(GLUT_WINDOW_NUM_SAMPLES));
1487
- rb_define_const(module, "GLUT_WINDOW_STEREO", INT2NUM(GLUT_WINDOW_STEREO));
1488
- rb_define_const(module, "GLUT_WINDOW_CURSOR", INT2NUM(GLUT_WINDOW_CURSOR));
1489
- rb_define_const(module, "GLUT_SCREEN_WIDTH", INT2NUM(GLUT_SCREEN_WIDTH));
1490
- rb_define_const(module, "GLUT_SCREEN_HEIGHT", INT2NUM(GLUT_SCREEN_HEIGHT));
1491
- rb_define_const(module, "GLUT_SCREEN_WIDTH_MM", INT2NUM(GLUT_SCREEN_WIDTH_MM));
1492
- rb_define_const(module, "GLUT_SCREEN_HEIGHT_MM", INT2NUM(GLUT_SCREEN_HEIGHT_MM));
1493
- rb_define_const(module, "GLUT_MENU_NUM_ITEMS", INT2NUM(GLUT_MENU_NUM_ITEMS));
1494
- rb_define_const(module, "GLUT_DISPLAY_MODE_POSSIBLE", INT2NUM(GLUT_DISPLAY_MODE_POSSIBLE));
1495
- rb_define_const(module, "GLUT_INIT_WINDOW_X", INT2NUM(GLUT_INIT_WINDOW_X));
1496
- rb_define_const(module, "GLUT_INIT_WINDOW_Y", INT2NUM(GLUT_INIT_WINDOW_Y));
1497
- rb_define_const(module, "GLUT_INIT_WINDOW_WIDTH", INT2NUM(GLUT_INIT_WINDOW_WIDTH));
1498
- rb_define_const(module, "GLUT_INIT_WINDOW_HEIGHT", INT2NUM(GLUT_INIT_WINDOW_HEIGHT));
1499
- rb_define_const(module, "GLUT_INIT_DISPLAY_MODE", INT2NUM(GLUT_INIT_DISPLAY_MODE));
1500
- rb_define_const(module, "GLUT_ELAPSED_TIME", INT2NUM(GLUT_ELAPSED_TIME));
1501
- rb_define_const(module, "GLUT_HAS_KEYBOARD", INT2NUM(GLUT_HAS_KEYBOARD));
1502
- rb_define_const(module, "GLUT_HAS_MOUSE", INT2NUM(GLUT_HAS_MOUSE));
1503
- rb_define_const(module, "GLUT_HAS_SPACEBALL", INT2NUM(GLUT_HAS_SPACEBALL));
1504
- rb_define_const(module, "GLUT_HAS_DIAL_AND_BUTTON_BOX", INT2NUM(GLUT_HAS_DIAL_AND_BUTTON_BOX));
1505
- rb_define_const(module, "GLUT_HAS_TABLET", INT2NUM(GLUT_HAS_TABLET));
1506
- rb_define_const(module, "GLUT_NUM_MOUSE_BUTTONS", INT2NUM(GLUT_NUM_MOUSE_BUTTONS));
1507
- rb_define_const(module, "GLUT_NUM_SPACEBALL_BUTTONS", INT2NUM(GLUT_NUM_SPACEBALL_BUTTONS));
1508
- rb_define_const(module, "GLUT_NUM_BUTTON_BOX_BUTTONS", INT2NUM(GLUT_NUM_BUTTON_BOX_BUTTONS));
1509
- rb_define_const(module, "GLUT_NUM_DIALS", INT2NUM(GLUT_NUM_DIALS));
1510
- rb_define_const(module, "GLUT_NUM_TABLET_BUTTONS", INT2NUM(GLUT_NUM_TABLET_BUTTONS));
1511
- rb_define_const(module, "GLUT_OVERLAY_POSSIBLE", INT2NUM(GLUT_OVERLAY_POSSIBLE));
1512
- rb_define_const(module, "GLUT_LAYER_IN_USE", INT2NUM(GLUT_LAYER_IN_USE));
1513
- rb_define_const(module, "GLUT_HAS_OVERLAY", INT2NUM(GLUT_HAS_OVERLAY));
1514
- rb_define_const(module, "GLUT_TRANSPARENT_INDEX", INT2NUM(GLUT_TRANSPARENT_INDEX));
1515
- rb_define_const(module, "GLUT_NORMAL_DAMAGED", INT2NUM(GLUT_NORMAL_DAMAGED));
1516
- rb_define_const(module, "GLUT_OVERLAY_DAMAGED", INT2NUM(GLUT_OVERLAY_DAMAGED));
1517
- rb_define_const(module, "GLUT_VIDEO_RESIZE_POSSIBLE", INT2NUM(GLUT_VIDEO_RESIZE_POSSIBLE));
1518
- rb_define_const(module, "GLUT_VIDEO_RESIZE_IN_USE", INT2NUM(GLUT_VIDEO_RESIZE_IN_USE));
1519
- rb_define_const(module, "GLUT_VIDEO_RESIZE_X_DELTA", INT2NUM(GLUT_VIDEO_RESIZE_X_DELTA));
1520
- rb_define_const(module, "GLUT_VIDEO_RESIZE_Y_DELTA", INT2NUM(GLUT_VIDEO_RESIZE_Y_DELTA));
1521
- rb_define_const(module, "GLUT_VIDEO_RESIZE_WIDTH_DELTA", INT2NUM(GLUT_VIDEO_RESIZE_WIDTH_DELTA));
1522
- rb_define_const(module, "GLUT_VIDEO_RESIZE_HEIGHT_DELTA", INT2NUM(GLUT_VIDEO_RESIZE_HEIGHT_DELTA));
1523
- rb_define_const(module, "GLUT_VIDEO_RESIZE_X", INT2NUM(GLUT_VIDEO_RESIZE_X));
1524
- rb_define_const(module, "GLUT_VIDEO_RESIZE_Y", INT2NUM(GLUT_VIDEO_RESIZE_Y));
1525
- rb_define_const(module, "GLUT_VIDEO_RESIZE_WIDTH", INT2NUM(GLUT_VIDEO_RESIZE_WIDTH));
1526
- rb_define_const(module, "GLUT_VIDEO_RESIZE_HEIGHT", INT2NUM(GLUT_VIDEO_RESIZE_HEIGHT));
1527
- rb_define_const(module, "GLUT_NORMAL", INT2NUM(GLUT_NORMAL));
1528
- rb_define_const(module, "GLUT_OVERLAY", INT2NUM(GLUT_OVERLAY));
1529
- rb_define_const(module, "GLUT_ACTIVE_SHIFT", INT2NUM(GLUT_ACTIVE_SHIFT));
1530
- rb_define_const(module, "GLUT_ACTIVE_CTRL", INT2NUM(GLUT_ACTIVE_CTRL));
1531
- rb_define_const(module, "GLUT_ACTIVE_ALT", INT2NUM(GLUT_ACTIVE_ALT));
1532
- rb_define_const(module, "GLUT_CURSOR_RIGHT_ARROW", INT2NUM(GLUT_CURSOR_RIGHT_ARROW));
1533
- rb_define_const(module, "GLUT_CURSOR_LEFT_ARROW", INT2NUM(GLUT_CURSOR_LEFT_ARROW));
1534
- rb_define_const(module, "GLUT_CURSOR_INFO", INT2NUM(GLUT_CURSOR_INFO));
1535
- rb_define_const(module, "GLUT_CURSOR_DESTROY", INT2NUM(GLUT_CURSOR_DESTROY));
1536
- rb_define_const(module, "GLUT_CURSOR_HELP", INT2NUM(GLUT_CURSOR_HELP));
1537
- rb_define_const(module, "GLUT_CURSOR_CYCLE", INT2NUM(GLUT_CURSOR_CYCLE));
1538
- rb_define_const(module, "GLUT_CURSOR_SPRAY", INT2NUM(GLUT_CURSOR_SPRAY));
1539
- rb_define_const(module, "GLUT_CURSOR_WAIT", INT2NUM(GLUT_CURSOR_WAIT));
1540
- rb_define_const(module, "GLUT_CURSOR_TEXT", INT2NUM(GLUT_CURSOR_TEXT));
1541
- rb_define_const(module, "GLUT_CURSOR_CROSSHAIR", INT2NUM(GLUT_CURSOR_CROSSHAIR));
1542
- rb_define_const(module, "GLUT_CURSOR_UP_DOWN", INT2NUM(GLUT_CURSOR_UP_DOWN));
1543
- rb_define_const(module, "GLUT_CURSOR_LEFT_RIGHT", INT2NUM(GLUT_CURSOR_LEFT_RIGHT));
1544
- rb_define_const(module, "GLUT_CURSOR_TOP_SIDE", INT2NUM(GLUT_CURSOR_TOP_SIDE));
1545
- rb_define_const(module, "GLUT_CURSOR_BOTTOM_SIDE", INT2NUM(GLUT_CURSOR_BOTTOM_SIDE));
1546
- rb_define_const(module, "GLUT_CURSOR_LEFT_SIDE", INT2NUM(GLUT_CURSOR_LEFT_SIDE));
1547
- rb_define_const(module, "GLUT_CURSOR_RIGHT_SIDE", INT2NUM(GLUT_CURSOR_RIGHT_SIDE));
1548
- rb_define_const(module, "GLUT_CURSOR_TOP_LEFT_CORNER", INT2NUM(GLUT_CURSOR_TOP_LEFT_CORNER));
1549
- rb_define_const(module, "GLUT_CURSOR_TOP_RIGHT_CORNER", INT2NUM(GLUT_CURSOR_TOP_RIGHT_CORNER));
1550
- rb_define_const(module, "GLUT_CURSOR_BOTTOM_RIGHT_CORNER", INT2NUM(GLUT_CURSOR_BOTTOM_RIGHT_CORNER));
1551
- rb_define_const(module, "GLUT_CURSOR_BOTTOM_LEFT_CORNER", INT2NUM(GLUT_CURSOR_BOTTOM_LEFT_CORNER));
1552
- rb_define_const(module, "GLUT_CURSOR_INHERIT", INT2NUM(GLUT_CURSOR_INHERIT));
1553
- rb_define_const(module, "GLUT_CURSOR_NONE", INT2NUM(GLUT_CURSOR_NONE));
1554
- rb_define_const(module, "GLUT_CURSOR_FULL_CROSSHAIR", INT2NUM(GLUT_CURSOR_FULL_CROSSHAIR));
1555
-
1556
- /* hardcoded, see bitmap_font_map for explanation */
1557
- rb_define_const(module, "GLUT_BITMAP_9_BY_15", INT2NUM(0));
1558
- rb_define_const(module, "GLUT_BITMAP_8_BY_13", INT2NUM(1));
1559
- rb_define_const(module, "GLUT_BITMAP_TIMES_ROMAN_10", INT2NUM(2));
1560
- rb_define_const(module, "GLUT_BITMAP_TIMES_ROMAN_24", INT2NUM(3));
1561
- rb_define_const(module, "GLUT_BITMAP_HELVETICA_10", INT2NUM(4));
1562
- rb_define_const(module, "GLUT_BITMAP_HELVETICA_12", INT2NUM(5));
1563
- rb_define_const(module, "GLUT_BITMAP_HELVETICA_18", INT2NUM(6));
1564
- rb_define_const(module, "GLUT_STROKE_ROMAN", INT2NUM(7));
1565
- rb_define_const(module, "GLUT_STROKE_MONO_ROMAN", INT2NUM(8));
1566
-
1567
- rb_define_const(module, "GLUT_WINDOW_FORMAT_ID", INT2NUM(GLUT_WINDOW_FORMAT_ID));
1568
- rb_define_const(module, "GLUT_DEVICE_IGNORE_KEY_REPEAT", INT2NUM(GLUT_DEVICE_IGNORE_KEY_REPEAT));
1569
- rb_define_const(module, "GLUT_DEVICE_KEY_REPEAT", INT2NUM(GLUT_DEVICE_KEY_REPEAT));
1570
- rb_define_const(module, "GLUT_HAS_JOYSTICK", INT2NUM(GLUT_HAS_JOYSTICK));
1571
- rb_define_const(module, "GLUT_OWNS_JOYSTICK", INT2NUM(GLUT_OWNS_JOYSTICK));
1572
- rb_define_const(module, "GLUT_JOYSTICK_BUTTONS", INT2NUM(GLUT_JOYSTICK_BUTTONS));
1573
- rb_define_const(module, "GLUT_JOYSTICK_AXES", INT2NUM(GLUT_JOYSTICK_AXES));
1574
- rb_define_const(module, "GLUT_JOYSTICK_POLL_RATE", INT2NUM(GLUT_JOYSTICK_POLL_RATE));
1575
- rb_define_const(module, "GLUT_KEY_REPEAT_OFF", INT2NUM(GLUT_KEY_REPEAT_OFF));
1576
- rb_define_const(module, "GLUT_KEY_REPEAT_ON", INT2NUM(GLUT_KEY_REPEAT_ON));
1577
- rb_define_const(module, "GLUT_KEY_REPEAT_DEFAULT", INT2NUM(GLUT_KEY_REPEAT_DEFAULT));
1578
- rb_define_const(module, "GLUT_JOYSTICK_BUTTON_A", INT2NUM(GLUT_JOYSTICK_BUTTON_A));
1579
- rb_define_const(module, "GLUT_JOYSTICK_BUTTON_B", INT2NUM(GLUT_JOYSTICK_BUTTON_B));
1580
- rb_define_const(module, "GLUT_JOYSTICK_BUTTON_C", INT2NUM(GLUT_JOYSTICK_BUTTON_C));
1581
- rb_define_const(module, "GLUT_JOYSTICK_BUTTON_D", INT2NUM(GLUT_JOYSTICK_BUTTON_D));
1582
- rb_define_const(module, "GLUT_GAME_MODE_ACTIVE", INT2NUM(GLUT_GAME_MODE_ACTIVE));
1583
- rb_define_const(module, "GLUT_GAME_MODE_POSSIBLE", INT2NUM(GLUT_GAME_MODE_POSSIBLE));
1584
- rb_define_const(module, "GLUT_GAME_MODE_WIDTH", INT2NUM(GLUT_GAME_MODE_WIDTH));
1585
- rb_define_const(module, "GLUT_GAME_MODE_HEIGHT", INT2NUM(GLUT_GAME_MODE_HEIGHT));
1586
- rb_define_const(module, "GLUT_GAME_MODE_PIXEL_DEPTH", INT2NUM(GLUT_GAME_MODE_PIXEL_DEPTH));
1587
- rb_define_const(module, "GLUT_GAME_MODE_REFRESH_RATE", INT2NUM(GLUT_GAME_MODE_REFRESH_RATE));
1588
- rb_define_const(module, "GLUT_GAME_MODE_DISPLAY_CHANGED", INT2NUM(GLUT_GAME_MODE_DISPLAY_CHANGED));
1589
-
1590
-
1591
- callId = rb_intern("call");
1592
-
1593
- WINDOW_CALLBACK_DEFINE(DisplayFunc);
1594
- WINDOW_CALLBACK_DEFINE(ReshapeFunc);
1595
- WINDOW_CALLBACK_DEFINE(KeyboardFunc);
1596
- WINDOW_CALLBACK_DEFINE(MouseFunc);
1597
- WINDOW_CALLBACK_DEFINE(MotionFunc);
1598
- WINDOW_CALLBACK_DEFINE(PassiveMotionFunc);
1599
- WINDOW_CALLBACK_DEFINE(EntryFunc);
1600
- WINDOW_CALLBACK_DEFINE(VisibilityFunc);
1601
- WINDOW_CALLBACK_DEFINE(SpecialFunc);
1602
- WINDOW_CALLBACK_DEFINE(SpaceballMotionFunc);
1603
- WINDOW_CALLBACK_DEFINE(SpaceballRotateFunc);
1604
- WINDOW_CALLBACK_DEFINE(SpaceballButtonFunc);
1605
- WINDOW_CALLBACK_DEFINE(ButtonBoxFunc);
1606
- WINDOW_CALLBACK_DEFINE(DialsFunc);
1607
- WINDOW_CALLBACK_DEFINE(TabletMotionFunc);
1608
- WINDOW_CALLBACK_DEFINE(TabletButtonFunc);
1609
- WINDOW_CALLBACK_DEFINE(OverlayDisplayFunc);
1610
- WINDOW_CALLBACK_DEFINE(WindowStatusFunc);
1611
- WINDOW_CALLBACK_DEFINE(KeyboardUpFunc);
1612
- WINDOW_CALLBACK_DEFINE(SpecialUpFunc);
1613
-
1614
- /* special case, 2 params */
1615
- rb_define_module_function(module, "glutJoystickFunc",glut_JoystickFunc , 2);
1616
- rb_global_variable(&JoystickFunc);
1617
- JoystickFunc = rb_ary_new();
1618
-
1619
- rb_gc_register_address(&idle_func);
1620
- rb_gc_register_address(&timer_func);
1621
- rb_gc_register_address(&menustate_func);
1622
- }
1623
-