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