glut 8.1.0

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