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