opengl-bindings 1.5.3 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ChangeLog +65 -0
- data/LICENSE.txt +1 -1
- data/README.md +116 -66
- data/lib/glfw.rb +175 -99
- data/lib/opengl_command.rb +0 -0
- data/lib/opengl_enum.rb +0 -0
- data/lib/opengl_es_command.rb +0 -0
- data/lib/opengl_es_enum.rb +0 -0
- data/lib/opengl_es_ext.rb +0 -0
- data/lib/opengl_es_ext_command.rb +503 -0
- data/lib/opengl_es_ext_enum.rb +229 -0
- data/lib/opengl_ext.rb +0 -0
- data/lib/opengl_ext_command.rb +90 -0
- data/lib/opengl_ext_common.rb +0 -0
- data/lib/opengl_ext_enum.rb +101 -0
- data/lib/opengl_linux.rb +0 -0
- data/lib/opengl_macosx.rb +0 -0
- data/sample/README.md +11 -11
- data/sample/glfw31_build_dylib.sh +0 -0
- data/sample/glfw32_build_dylib.sh +22 -0
- data/sample/report_env.rb +2 -2
- data/sample/report_env_es.rb +0 -0
- data/sample/simple.rb +0 -0
- data/sample/simple_glut.rb +0 -0
- metadata +5 -6
- data/lib/glfw30.rb +0 -509
- data/sample/glfw30_build_dylib.sh +0 -22
data/lib/opengl_linux.rb
CHANGED
File without changes
|
data/lib/opengl_macosx.rb
CHANGED
File without changes
|
data/sample/README.md
CHANGED
@@ -27,26 +27,26 @@ For more samples, visit https://github.com/vaiorabbit/ruby-opengl/tree/master/sa
|
|
27
27
|
|
28
28
|
-------------------------------------------------------------------------------
|
29
29
|
|
30
|
-
## GLFW
|
30
|
+
## GLFWのセットアップ (http://www.glfw.org) ##
|
31
31
|
|
32
32
|
* Windows
|
33
|
-
* glfw3.dll
|
34
|
-
*
|
33
|
+
* glfw3.dll をここに配置してください。
|
34
|
+
* コンパイル済みバイナリはこちら:
|
35
35
|
* http://www.glfw.org/download.html
|
36
36
|
|
37
37
|
* Mac OS X
|
38
|
-
* ./glfwXX_build_dylib.sh
|
38
|
+
* ./glfwXX_build_dylib.sh を実行すると ./libglfw.dylib ができあがります。
|
39
39
|
|
40
|
-
## GLUT
|
40
|
+
## GLUTのセットアップ ##
|
41
41
|
|
42
42
|
* Windows
|
43
|
-
* freeglut
|
44
|
-
* freeglut.dll
|
45
|
-
*
|
43
|
+
* freeglut を使ってください (http://freeglut.sourceforge.net).
|
44
|
+
* freeglut.dll をここに配置してください。
|
45
|
+
* コンパイル済みバイナリはこちら:
|
46
46
|
* http://www.transmissionzero.co.uk/software/freeglut-devel/
|
47
47
|
|
48
48
|
* Mac OS X
|
49
|
-
* glut.rb
|
50
|
-
*
|
51
|
-
* util/setup_dll.rb
|
49
|
+
* glut.rb はデフォルトで /System/Library/Frameworks/GLUT.framework を使います。
|
50
|
+
* もしこれとは別のGLUTを使いたい場合は 'GLUT.load_dll' の引数で指定してください。
|
51
|
+
* util/setup_dll.rb が使用例となっています。
|
52
52
|
* https://github.com/vaiorabbit/ruby-opengl/blob/master/sample/util/setup_dll.rb
|
File without changes
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#
|
2
|
+
# For Mac OS X + Xcode + CMake users.
|
3
|
+
#
|
4
|
+
# Ref.: https://github.com/malkia/ufo/blob/master/build/OSX/glfw.sh
|
5
|
+
#
|
6
|
+
wget https://github.com/glfw/glfw/releases/download/3.2/glfw-3.2.zip
|
7
|
+
tar xvjf glfw-3.2.zip
|
8
|
+
cd glfw-3.2/
|
9
|
+
mkdir build
|
10
|
+
cd build
|
11
|
+
export MACOSX_DEPLOYMENT_TARGET=10.11
|
12
|
+
cmake -D CMAKE_BUILD_TYPE=Release -D GLFW_NATIVE_API=1 -D CMAKE_OSX_ARCHITECTURES="i386;x86_64" -D BUILD_SHARED_LIBS=ON -D CMAKE_C_COMPILER=clang ../
|
13
|
+
make
|
14
|
+
|
15
|
+
# 'ls -l src/libglfw*' should be:
|
16
|
+
#
|
17
|
+
# $ ls -l src/libglfw*
|
18
|
+
# -rwxr-xr-x 1 foo staff 238124 2016-06-03 20:49 libglfw.3.2.dylib
|
19
|
+
# lrwxr-xr-x 1 foo staff 17 2016-06-03 20:49 libglfw.3.dylib -> libglfw.3.2.dylib
|
20
|
+
# lrwxr-xr-x 1 foo staff 15 2016-06-03 20:49 libglfw.dylib -> libglfw.3.dylib
|
21
|
+
|
22
|
+
cp -R src/libglfw* ../..
|
data/sample/report_env.rb
CHANGED
@@ -19,9 +19,9 @@ if __FILE__ == $0
|
|
19
19
|
window = nil
|
20
20
|
[4, 3].each do |major_ver|
|
21
21
|
glfwDefaultWindowHints()
|
22
|
-
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE)
|
22
|
+
# glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE)
|
23
23
|
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE)
|
24
|
-
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, major_ver)
|
24
|
+
# glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, major_ver)
|
25
25
|
glfwWindowHint(GLFW_DECORATED, 0)
|
26
26
|
window = glfwCreateWindow( 1, 1, "Report OpenGL Environment", nil, nil )
|
27
27
|
break unless window.null?
|
data/sample/report_env_es.rb
CHANGED
File without changes
|
data/sample/simple.rb
CHANGED
File without changes
|
data/sample/simple_glut.rb
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opengl-bindings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- vaiorabbit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 'Ruby bindings for OpenGL - 4.5, OpenGL ES - 3.2 and all extensions using
|
14
14
|
Fiddle (For MRI >= 2.0.0). GLFW/GLUT/GLU bindings are also available.
|
@@ -24,7 +24,6 @@ files:
|
|
24
24
|
- LICENSE.txt
|
25
25
|
- README.md
|
26
26
|
- lib/glfw.rb
|
27
|
-
- lib/glfw30.rb
|
28
27
|
- lib/glu.rb
|
29
28
|
- lib/glut.rb
|
30
29
|
- lib/opengl.rb
|
@@ -46,15 +45,15 @@ files:
|
|
46
45
|
- lib/opengl_platform.rb
|
47
46
|
- lib/opengl_windows.rb
|
48
47
|
- sample/README.md
|
49
|
-
- sample/glfw30_build_dylib.sh
|
50
48
|
- sample/glfw31_build_dylib.sh
|
49
|
+
- sample/glfw32_build_dylib.sh
|
51
50
|
- sample/report_env.rb
|
52
51
|
- sample/report_env_es.rb
|
53
52
|
- sample/simple.rb
|
54
53
|
- sample/simple_glut.rb
|
55
54
|
homepage: https://github.com/vaiorabbit/ruby-opengl
|
56
55
|
licenses:
|
57
|
-
-
|
56
|
+
- Zlib
|
58
57
|
metadata: {}
|
59
58
|
post_install_message:
|
60
59
|
rdoc_options: []
|
@@ -72,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
71
|
version: '0'
|
73
72
|
requirements: []
|
74
73
|
rubyforge_project:
|
75
|
-
rubygems_version: 2.4
|
74
|
+
rubygems_version: 2.6.4
|
76
75
|
signing_key:
|
77
76
|
specification_version: 4
|
78
77
|
summary: Bindings for OpenGL -4.5, ES - 3.2 and extensions (For MRI >= 2.0.0)
|
data/lib/glfw30.rb
DELETED
@@ -1,509 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
# A GLFW wrapper (for version 3.0)
|
3
|
-
require 'fiddle/import'
|
4
|
-
|
5
|
-
module GLFW
|
6
|
-
|
7
|
-
extend Fiddle::Importer
|
8
|
-
|
9
|
-
#
|
10
|
-
# Fiddle's default 'extern' stores all methods into local variable '@func_map', that makes difficult to 'include GLFW'.
|
11
|
-
# So I override it and replace '@func_map' into 'GLFW_FUNCTIONS_MAP'.
|
12
|
-
# Ref.: /lib/ruby/2.0.0/fiddle/import.rb
|
13
|
-
#
|
14
|
-
GLFW_FUNCTIONS_MAP = {}
|
15
|
-
def self.extern(signature, *opts)
|
16
|
-
symname, ctype, argtype = parse_signature(signature, @type_alias)
|
17
|
-
opt = parse_bind_options(opts)
|
18
|
-
f = import_function(symname, ctype, argtype, opt[:call_type])
|
19
|
-
name = symname.gsub(/@.+/,'')
|
20
|
-
GLFW_FUNCTIONS_MAP[name] = f
|
21
|
-
begin
|
22
|
-
/^(.+?):(\d+)/ =~ caller.first
|
23
|
-
file, line = $1, $2.to_i
|
24
|
-
rescue
|
25
|
-
file, line = __FILE__, __LINE__+3
|
26
|
-
end
|
27
|
-
args_str="*args"
|
28
|
-
module_eval(<<-EOS, file, line)
|
29
|
-
def #{name}(*args, &block)
|
30
|
-
GLFW_FUNCTIONS_MAP['#{name}'].call(*args,&block)
|
31
|
-
end
|
32
|
-
EOS
|
33
|
-
module_function(name)
|
34
|
-
f
|
35
|
-
end
|
36
|
-
|
37
|
-
# defines
|
38
|
-
GLFW_VERSION_MAJOR = 3
|
39
|
-
GLFW_VERSION_MINOR = 0
|
40
|
-
GLFW_VERSION_REVISION = 1
|
41
|
-
|
42
|
-
GLFW_RELEASE = 0
|
43
|
-
GLFW_PRESS = 1
|
44
|
-
GLFW_REPEAT = 2
|
45
|
-
|
46
|
-
GLFW_KEY_UNKNOWN = -1
|
47
|
-
|
48
|
-
GLFW_KEY_SPACE = 32
|
49
|
-
GLFW_KEY_APOSTROPHE = 39 # '
|
50
|
-
GLFW_KEY_COMMA = 44 # ,
|
51
|
-
GLFW_KEY_MINUS = 45 # -
|
52
|
-
GLFW_KEY_PERIOD = 46 # .
|
53
|
-
GLFW_KEY_SLASH = 47 # /
|
54
|
-
GLFW_KEY_0 = 48
|
55
|
-
GLFW_KEY_1 = 49
|
56
|
-
GLFW_KEY_2 = 50
|
57
|
-
GLFW_KEY_3 = 51
|
58
|
-
GLFW_KEY_4 = 52
|
59
|
-
GLFW_KEY_5 = 53
|
60
|
-
GLFW_KEY_6 = 54
|
61
|
-
GLFW_KEY_7 = 55
|
62
|
-
GLFW_KEY_8 = 56
|
63
|
-
GLFW_KEY_9 = 57
|
64
|
-
GLFW_KEY_SEMICOLON = 59 # ;
|
65
|
-
GLFW_KEY_EQUAL = 61 # =
|
66
|
-
GLFW_KEY_A = 65
|
67
|
-
GLFW_KEY_B = 66
|
68
|
-
GLFW_KEY_C = 67
|
69
|
-
GLFW_KEY_D = 68
|
70
|
-
GLFW_KEY_E = 69
|
71
|
-
GLFW_KEY_F = 70
|
72
|
-
GLFW_KEY_G = 71
|
73
|
-
GLFW_KEY_H = 72
|
74
|
-
GLFW_KEY_I = 73
|
75
|
-
GLFW_KEY_J = 74
|
76
|
-
GLFW_KEY_K = 75
|
77
|
-
GLFW_KEY_L = 76
|
78
|
-
GLFW_KEY_M = 77
|
79
|
-
GLFW_KEY_N = 78
|
80
|
-
GLFW_KEY_O = 79
|
81
|
-
GLFW_KEY_P = 80
|
82
|
-
GLFW_KEY_Q = 81
|
83
|
-
GLFW_KEY_R = 82
|
84
|
-
GLFW_KEY_S = 83
|
85
|
-
GLFW_KEY_T = 84
|
86
|
-
GLFW_KEY_U = 85
|
87
|
-
GLFW_KEY_V = 86
|
88
|
-
GLFW_KEY_W = 87
|
89
|
-
GLFW_KEY_X = 88
|
90
|
-
GLFW_KEY_Y = 89
|
91
|
-
GLFW_KEY_Z = 90
|
92
|
-
GLFW_KEY_LEFT_BRACKET = 91 # [
|
93
|
-
GLFW_KEY_BACKSLASH = 92 # \
|
94
|
-
GLFW_KEY_RIGHT_BRACKET = 93 # ]
|
95
|
-
GLFW_KEY_GRAVE_ACCENT = 96 # `
|
96
|
-
GLFW_KEY_WORLD_1 = 161 # non-US #1
|
97
|
-
GLFW_KEY_WORLD_2 = 162 # non-US #2
|
98
|
-
|
99
|
-
GLFW_KEY_ESCAPE = 256
|
100
|
-
GLFW_KEY_ENTER = 257
|
101
|
-
GLFW_KEY_TAB = 258
|
102
|
-
GLFW_KEY_BACKSPACE = 259
|
103
|
-
GLFW_KEY_INSERT = 260
|
104
|
-
GLFW_KEY_DELETE = 261
|
105
|
-
GLFW_KEY_RIGHT = 262
|
106
|
-
GLFW_KEY_LEFT = 263
|
107
|
-
GLFW_KEY_DOWN = 264
|
108
|
-
GLFW_KEY_UP = 265
|
109
|
-
GLFW_KEY_PAGE_UP = 266
|
110
|
-
GLFW_KEY_PAGE_DOWN = 267
|
111
|
-
GLFW_KEY_HOME = 268
|
112
|
-
GLFW_KEY_END = 269
|
113
|
-
GLFW_KEY_CAPS_LOCK = 280
|
114
|
-
GLFW_KEY_SCROLL_LOCK = 281
|
115
|
-
GLFW_KEY_NUM_LOCK = 282
|
116
|
-
GLFW_KEY_PRINT_SCREEN = 283
|
117
|
-
GLFW_KEY_PAUSE = 284
|
118
|
-
GLFW_KEY_F1 = 290
|
119
|
-
GLFW_KEY_F2 = 291
|
120
|
-
GLFW_KEY_F3 = 292
|
121
|
-
GLFW_KEY_F4 = 293
|
122
|
-
GLFW_KEY_F5 = 294
|
123
|
-
GLFW_KEY_F6 = 295
|
124
|
-
GLFW_KEY_F7 = 296
|
125
|
-
GLFW_KEY_F8 = 297
|
126
|
-
GLFW_KEY_F9 = 298
|
127
|
-
GLFW_KEY_F10 = 299
|
128
|
-
GLFW_KEY_F11 = 300
|
129
|
-
GLFW_KEY_F12 = 301
|
130
|
-
GLFW_KEY_F13 = 302
|
131
|
-
GLFW_KEY_F14 = 303
|
132
|
-
GLFW_KEY_F15 = 304
|
133
|
-
GLFW_KEY_F16 = 305
|
134
|
-
GLFW_KEY_F17 = 306
|
135
|
-
GLFW_KEY_F18 = 307
|
136
|
-
GLFW_KEY_F19 = 308
|
137
|
-
GLFW_KEY_F20 = 309
|
138
|
-
GLFW_KEY_F21 = 310
|
139
|
-
GLFW_KEY_F22 = 311
|
140
|
-
GLFW_KEY_F23 = 312
|
141
|
-
GLFW_KEY_F24 = 313
|
142
|
-
GLFW_KEY_F25 = 314
|
143
|
-
GLFW_KEY_KP_0 = 320
|
144
|
-
GLFW_KEY_KP_1 = 321
|
145
|
-
GLFW_KEY_KP_2 = 322
|
146
|
-
GLFW_KEY_KP_3 = 323
|
147
|
-
GLFW_KEY_KP_4 = 324
|
148
|
-
GLFW_KEY_KP_5 = 325
|
149
|
-
GLFW_KEY_KP_6 = 326
|
150
|
-
GLFW_KEY_KP_7 = 327
|
151
|
-
GLFW_KEY_KP_8 = 328
|
152
|
-
GLFW_KEY_KP_9 = 329
|
153
|
-
GLFW_KEY_KP_DECIMAL = 330
|
154
|
-
GLFW_KEY_KP_DIVIDE = 331
|
155
|
-
GLFW_KEY_KP_MULTIPLY = 332
|
156
|
-
GLFW_KEY_KP_SUBTRACT = 333
|
157
|
-
GLFW_KEY_KP_ADD = 334
|
158
|
-
GLFW_KEY_KP_ENTER = 335
|
159
|
-
GLFW_KEY_KP_EQUAL = 336
|
160
|
-
GLFW_KEY_LEFT_SHIFT = 340
|
161
|
-
GLFW_KEY_LEFT_CONTROL = 341
|
162
|
-
GLFW_KEY_LEFT_ALT = 342
|
163
|
-
GLFW_KEY_LEFT_SUPER = 343
|
164
|
-
GLFW_KEY_RIGHT_SHIFT = 344
|
165
|
-
GLFW_KEY_RIGHT_CONTROL = 345
|
166
|
-
GLFW_KEY_RIGHT_ALT = 346
|
167
|
-
GLFW_KEY_RIGHT_SUPER = 347
|
168
|
-
GLFW_KEY_MENU = 348
|
169
|
-
GLFW_KEY_LAST = GLFW_KEY_MENU
|
170
|
-
|
171
|
-
GLFW_MOD_SHIFT = 0x0001
|
172
|
-
GLFW_MOD_CONTROL = 0x0002
|
173
|
-
GLFW_MOD_ALT = 0x0004
|
174
|
-
GLFW_MOD_SUPER = 0x0008
|
175
|
-
|
176
|
-
GLFW_MOUSE_BUTTON_1 = 0
|
177
|
-
GLFW_MOUSE_BUTTON_2 = 1
|
178
|
-
GLFW_MOUSE_BUTTON_3 = 2
|
179
|
-
GLFW_MOUSE_BUTTON_4 = 3
|
180
|
-
GLFW_MOUSE_BUTTON_5 = 4
|
181
|
-
GLFW_MOUSE_BUTTON_6 = 5
|
182
|
-
GLFW_MOUSE_BUTTON_7 = 6
|
183
|
-
GLFW_MOUSE_BUTTON_8 = 7
|
184
|
-
GLFW_MOUSE_BUTTON_LAST = GLFW_MOUSE_BUTTON_8
|
185
|
-
GLFW_MOUSE_BUTTON_LEFT = GLFW_MOUSE_BUTTON_1
|
186
|
-
GLFW_MOUSE_BUTTON_RIGHT = GLFW_MOUSE_BUTTON_2
|
187
|
-
GLFW_MOUSE_BUTTON_MIDDLE = GLFW_MOUSE_BUTTON_3
|
188
|
-
|
189
|
-
GLFW_JOYSTICK_1 = 0
|
190
|
-
GLFW_JOYSTICK_2 = 1
|
191
|
-
GLFW_JOYSTICK_3 = 2
|
192
|
-
GLFW_JOYSTICK_4 = 3
|
193
|
-
GLFW_JOYSTICK_5 = 4
|
194
|
-
GLFW_JOYSTICK_6 = 5
|
195
|
-
GLFW_JOYSTICK_7 = 6
|
196
|
-
GLFW_JOYSTICK_8 = 7
|
197
|
-
GLFW_JOYSTICK_9 = 8
|
198
|
-
GLFW_JOYSTICK_10 = 9
|
199
|
-
GLFW_JOYSTICK_11 = 10
|
200
|
-
GLFW_JOYSTICK_12 = 11
|
201
|
-
GLFW_JOYSTICK_13 = 12
|
202
|
-
GLFW_JOYSTICK_14 = 13
|
203
|
-
GLFW_JOYSTICK_15 = 14
|
204
|
-
GLFW_JOYSTICK_16 = 15
|
205
|
-
GLFW_JOYSTICK_LAST = GLFW_JOYSTICK_16
|
206
|
-
|
207
|
-
GLFW_NOT_INITIALIZED = 0x00010001
|
208
|
-
GLFW_NO_CURRENT_CONTEXT = 0x00010002
|
209
|
-
GLFW_INVALID_ENUM = 0x00010003
|
210
|
-
GLFW_INVALID_VALUE = 0x00010004
|
211
|
-
GLFW_OUT_OF_MEMORY = 0x00010005
|
212
|
-
GLFW_API_UNAVAILABLE = 0x00010006
|
213
|
-
GLFW_VERSION_UNAVAILABLE = 0x00010007
|
214
|
-
GLFW_PLATFORM_ERROR = 0x00010008
|
215
|
-
GLFW_FORMAT_UNAVAILABLE = 0x00010009
|
216
|
-
|
217
|
-
GLFW_FOCUSED = 0x00020001
|
218
|
-
GLFW_ICONIFIED = 0x00020002
|
219
|
-
GLFW_RESIZABLE = 0x00020003
|
220
|
-
GLFW_VISIBLE = 0x00020004
|
221
|
-
GLFW_DECORATED = 0x00020005
|
222
|
-
|
223
|
-
GLFW_RED_BITS = 0x00021001
|
224
|
-
GLFW_GREEN_BITS = 0x00021002
|
225
|
-
GLFW_BLUE_BITS = 0x00021003
|
226
|
-
GLFW_ALPHA_BITS = 0x00021004
|
227
|
-
GLFW_DEPTH_BITS = 0x00021005
|
228
|
-
GLFW_STENCIL_BITS = 0x00021006
|
229
|
-
GLFW_ACCUM_RED_BITS = 0x00021007
|
230
|
-
GLFW_ACCUM_GREEN_BITS = 0x00021008
|
231
|
-
GLFW_ACCUM_BLUE_BITS = 0x00021009
|
232
|
-
GLFW_ACCUM_ALPHA_BITS = 0x0002100A
|
233
|
-
GLFW_AUX_BUFFERS = 0x0002100B
|
234
|
-
GLFW_STEREO = 0x0002100C
|
235
|
-
GLFW_SAMPLES = 0x0002100D
|
236
|
-
GLFW_SRGB_CAPABLE = 0x0002100E
|
237
|
-
GLFW_REFRESH_RATE = 0x0002100F
|
238
|
-
|
239
|
-
GLFW_CLIENT_API = 0x00022001
|
240
|
-
GLFW_CONTEXT_VERSION_MAJOR = 0x00022002
|
241
|
-
GLFW_CONTEXT_VERSION_MINOR = 0x00022003
|
242
|
-
GLFW_CONTEXT_REVISION = 0x00022004
|
243
|
-
GLFW_CONTEXT_ROBUSTNESS = 0x00022005
|
244
|
-
GLFW_OPENGL_FORWARD_COMPAT = 0x00022006
|
245
|
-
GLFW_OPENGL_DEBUG_CONTEXT = 0x00022007
|
246
|
-
GLFW_OPENGL_PROFILE = 0x00022008
|
247
|
-
|
248
|
-
GLFW_OPENGL_API = 0x00030001
|
249
|
-
GLFW_OPENGL_ES_API = 0x00030002
|
250
|
-
|
251
|
-
GLFW_NO_ROBUSTNESS = 0
|
252
|
-
GLFW_NO_RESET_NOTIFICATION = 0x00031001
|
253
|
-
GLFW_LOSE_CONTEXT_ON_RESET = 0x00031002
|
254
|
-
|
255
|
-
GLFW_OPENGL_ANY_PROFILE = 0
|
256
|
-
GLFW_OPENGL_CORE_PROFILE = 0x00032001
|
257
|
-
GLFW_OPENGL_COMPAT_PROFILE = 0x00032002
|
258
|
-
|
259
|
-
GLFW_CURSOR = 0x00033001
|
260
|
-
GLFW_STICKY_KEYS = 0x00033002
|
261
|
-
GLFW_STICKY_MOUSE_BUTTONS = 0x00033003
|
262
|
-
|
263
|
-
GLFW_CURSOR_NORMAL = 0x00034001
|
264
|
-
GLFW_CURSOR_HIDDEN = 0x00034002
|
265
|
-
GLFW_CURSOR_DISABLED = 0x00034003
|
266
|
-
|
267
|
-
GLFW_CONNECTED = 0x00040001
|
268
|
-
GLFW_DISCONNECTED = 0x00040002
|
269
|
-
|
270
|
-
# typedefs
|
271
|
-
@@glfw_cb_function_signature = {
|
272
|
-
:GLFWerrorfun => "void GLFWerrorfun(int,const char*)",
|
273
|
-
:GLFWwindowposfun => "void GLFWwindowposfun(void*,int,int)",
|
274
|
-
:GLFWwindowsizefun => "void GLFWwindowsizefun(void*,int,int)",
|
275
|
-
:GLFWwindowclosefun => "void GLFWwindowclosefun(void*)",
|
276
|
-
:GLFWwindowrefreshfun => "void GLFWwindowrefreshfun(void*)",
|
277
|
-
:GLFWwindowfocusfun => "void GLFWwindowfocusfun(void*,int)",
|
278
|
-
:GLFWwindowiconifyfun => "void GLFWwindowiconifyfun(void*,int)",
|
279
|
-
:GLFWframebuffersizefun => "void GLFWframebuffersizefun(void*,int,int)",
|
280
|
-
:GLFWmousebuttonfun => "void GLFWmousebuttonfun(void*,int,int,int)",
|
281
|
-
:GLFWcursorposfun => "void GLFWcursorposfun(void*,double,double)",
|
282
|
-
:GLFWcursorenterfun => "void GLFWcursorenterfun(void*,int)",
|
283
|
-
:GLFWscrollfun => "void GLFWscrollfun(void*,double,double)",
|
284
|
-
:GLFWkeyfun => "void GLFWkeyfun(void*,int,int,int,int)",
|
285
|
-
:GLFWcharfun => "void GLFWcharfun(void*,unsigned int)",
|
286
|
-
:GLFWmonitorfun => "void GLFWmonitorfun(void*,int)",
|
287
|
-
}
|
288
|
-
|
289
|
-
# Creates a callback as an instance of Fiddle::Function
|
290
|
-
def self.create_callback_function( sym, proc=nil, &blk )
|
291
|
-
if block_given?
|
292
|
-
return bind( @@glfw_cb_function_signature[sym], nil, &blk )
|
293
|
-
else
|
294
|
-
return bind( @@glfw_cb_function_signature[sym], nil, &proc )
|
295
|
-
end
|
296
|
-
end
|
297
|
-
|
298
|
-
GLFWerrorfun_cb_args = [Fiddle::TYPE_INT, Fiddle::TYPE_VOIDP]
|
299
|
-
GLFWerrorfun_cb_retval = Fiddle::TYPE_VOID
|
300
|
-
GLFWwindowposfun_cb_args = [Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT, Fiddle::TYPE_INT]
|
301
|
-
GLFWwindowposfun_cb_retval = Fiddle::TYPE_VOID
|
302
|
-
GLFWwindowsizefun_cb_args = [Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT, Fiddle::TYPE_INT]
|
303
|
-
GLFWwindowsizefun_cb_retval = Fiddle::TYPE_VOID
|
304
|
-
GLFWwindowclosefun_cb_args = [Fiddle::TYPE_VOIDP]
|
305
|
-
GLFWwindowclosefun_cb_retval = Fiddle::TYPE_VOID
|
306
|
-
GLFWwindowrefreshfun_cb_args = [Fiddle::TYPE_VOIDP]
|
307
|
-
GLFWwindowrefreshfun_cb_retval = Fiddle::TYPE_VOID
|
308
|
-
GLFWwindowfocusfun_cb_args = [Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT]
|
309
|
-
GLFWwindowfocusfun_cb_retval = Fiddle::TYPE_VOID
|
310
|
-
GLFWwindowiconifyfun_cb_args = [Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT]
|
311
|
-
GLFWwindowiconifyfun_cb_retval = Fiddle::TYPE_VOID
|
312
|
-
GLFWframebuffersizefun_cb_args = [Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT, Fiddle::TYPE_INT]
|
313
|
-
GLFWframebuffersizefun_cb_retval = Fiddle::TYPE_VOID
|
314
|
-
GLFWmousebuttonfun_cb_args = [Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT, Fiddle::TYPE_INT, Fiddle::TYPE_INT]
|
315
|
-
GLFWmousebuttonfun_cb_retval = Fiddle::TYPE_VOID
|
316
|
-
GLFWcursorposfun_cb_args = [Fiddle::TYPE_VOIDP, Fiddle::TYPE_DOUBLE, Fiddle::TYPE_DOUBLE]
|
317
|
-
GLFWcursorposfun_cb_retval = Fiddle::TYPE_VOID
|
318
|
-
GLFWcursorenterfun_cb_args = [Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT]
|
319
|
-
GLFWcursorenterfun_cb_retval = Fiddle::TYPE_VOID
|
320
|
-
GLFWscrollfun_cb_args = [Fiddle::TYPE_VOIDP, Fiddle::TYPE_DOUBLE, Fiddle::TYPE_DOUBLE]
|
321
|
-
GLFWscrollfun_cb_retval = Fiddle::TYPE_VOID
|
322
|
-
GLFWkeyfun_cb_args = [Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT, Fiddle::TYPE_INT, Fiddle::TYPE_INT, Fiddle::TYPE_INT]
|
323
|
-
GLFWkeyfun_cb_retval = Fiddle::TYPE_VOID
|
324
|
-
GLFWcharfun_cb_args = [Fiddle::TYPE_VOIDP, -Fiddle::TYPE_INT]
|
325
|
-
GLFWcharfun_cb_retval = Fiddle::TYPE_VOID
|
326
|
-
GLFWmonitorfun_cb_args = [Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT]
|
327
|
-
GLFWmonitorfun_cb_retval = Fiddle::TYPE_VOID
|
328
|
-
|
329
|
-
@@glfw_cb_closure_signature = {
|
330
|
-
:GLFWerrorfun => [GLFWerrorfun_cb_retval, GLFWerrorfun_cb_args],
|
331
|
-
:GLFWwindowposfun => [GLFWwindowposfun_cb_retval, GLFWwindowposfun_cb_args],
|
332
|
-
:GLFWwindowsizefun => [GLFWwindowsizefun_cb_retval, GLFWwindowsizefun_cb_args],
|
333
|
-
:GLFWwindowclosefun => [GLFWwindowclosefun_cb_retval, GLFWwindowclosefun_cb_args],
|
334
|
-
:GLFWwindowrefreshfun => [GLFWwindowrefreshfun_cb_retval, GLFWwindowrefreshfun_cb_args],
|
335
|
-
:GLFWwindowfocusfun => [GLFWwindowfocusfun_cb_retval, GLFWwindowfocusfun_cb_args],
|
336
|
-
:GLFWwindowiconifyfun => [GLFWwindowiconifyfun_cb_retval, GLFWwindowiconifyfun_cb_args],
|
337
|
-
:GLFWframebuffersizefun => [GLFWframebuffersizefun_cb_retval, GLFWframebuffersizefun_cb_args],
|
338
|
-
:GLFWmousebuttonfun => [GLFWmousebuttonfun_cb_retval, GLFWmousebuttonfun_cb_args],
|
339
|
-
:GLFWcursorposfun => [GLFWcursorposfun_cb_retval, GLFWcursorposfun_cb_args],
|
340
|
-
:GLFWcursorenterfun => [GLFWcursorenterfun_cb_retval, GLFWcursorenterfun_cb_args],
|
341
|
-
:GLFWscrollfun => [GLFWscrollfun_cb_retval, GLFWscrollfun_cb_args],
|
342
|
-
:GLFWkeyfun => [GLFWkeyfun_cb_retval, GLFWkeyfun_cb_args],
|
343
|
-
:GLFWcharfun => [GLFWcharfun_cb_retval, GLFWcharfun_cb_args],
|
344
|
-
:GLFWmonitorfun => [GLFWmonitorfun_cb_retval, GLFWmonitorfun_cb_args],
|
345
|
-
}
|
346
|
-
|
347
|
-
# Creates a callback as an instance of Fiddle::Closure::BlockCaller
|
348
|
-
def self.create_callback_closure( sym, proc=nil, &blk )
|
349
|
-
cb_retval = @@glfw_cb_closure_signature[sym][0]
|
350
|
-
cb_args = @@glfw_cb_closure_signature[sym][1]
|
351
|
-
if block_given?
|
352
|
-
return Fiddle::Closure::BlockCaller.new( cb_retval, cb_args, Fiddle::Function::DEFAULT, &blk )
|
353
|
-
else
|
354
|
-
return Fiddle::Closure::BlockCaller.new( cb_retval, cb_args, Fiddle::Function::DEFAULT, &proc )
|
355
|
-
end
|
356
|
-
end
|
357
|
-
|
358
|
-
# NOTE : Use 'create_callback_function' for backward compatibility.
|
359
|
-
def self.create_callback( sym, proc=nil, &blk )
|
360
|
-
return self.create_callback_closure( sym, proc, &blk )
|
361
|
-
end
|
362
|
-
|
363
|
-
|
364
|
-
# typedefs
|
365
|
-
@@glfw_cb_signature = {
|
366
|
-
:GLFWerrorfun => "void GLFWerrorfun(int,const char*)",
|
367
|
-
:GLFWwindowposfun => "void GLFWwindowposfun(void*,int,int)",
|
368
|
-
:GLFWwindowsizefun => "void GLFWwindowsizefun(void*,int,int)",
|
369
|
-
:GLFWwindowclosefun => "void GLFWwindowclosefun(void*)",
|
370
|
-
:GLFWwindowrefreshfun => "void GLFWwindowrefreshfun(void*)",
|
371
|
-
:GLFWwindowfocusfun => "void GLFWwindowfocusfun(void*,int)",
|
372
|
-
:GLFWwindowiconifyfun => "void GLFWwindowiconifyfun(void*,int)",
|
373
|
-
:GLFWframebuffersizefun => "void GLFWframebuffersizefun(void*,int,int)",
|
374
|
-
:GLFWmousebuttonfun => "void GLFWmousebuttonfun(void*,int,int,int)",
|
375
|
-
:GLFWcursorposfun => "void GLFWcursorposfun(void*,double,double)",
|
376
|
-
:GLFWcursorenterfun => "void GLFWcursorenterfun(void*,int)",
|
377
|
-
:GLFWscrollfun => "void GLFWscrollfun(void*,double,double)",
|
378
|
-
:GLFWkeyfun => "void GLFWkeyfun(void*,int,int,int,int)",
|
379
|
-
:GLFWcharfun => "void GLFWcharfun(void*,unsigned int)",
|
380
|
-
:GLFWmonitorfun => "void GLFWmonitorfun(void*,int)",
|
381
|
-
}
|
382
|
-
|
383
|
-
def self.create_callback( sym, proc=nil, &blk )
|
384
|
-
if block_given?
|
385
|
-
return bind( @@glfw_cb_signature[sym], nil, &blk )
|
386
|
-
else
|
387
|
-
return bind( @@glfw_cb_signature[sym], nil, &proc )
|
388
|
-
end
|
389
|
-
end
|
390
|
-
|
391
|
-
# struct
|
392
|
-
GLFWvidmode = struct(["int width",
|
393
|
-
"int height",
|
394
|
-
"int redBits",
|
395
|
-
"int greenBits",
|
396
|
-
"int blueBits",
|
397
|
-
"int refreshRate"])
|
398
|
-
|
399
|
-
GLFWgammaramp = struct(["unsigned short* red",
|
400
|
-
"unsigned short* green",
|
401
|
-
"unsigned short* blue",
|
402
|
-
"unsigned int size"])
|
403
|
-
|
404
|
-
@@glfw_import_done = false
|
405
|
-
|
406
|
-
# Load native library.
|
407
|
-
def self.load_lib(lib = nil, path = nil)
|
408
|
-
if lib == nil && path == nil
|
409
|
-
case OpenGL.get_platform
|
410
|
-
when :OPENGL_PLATFORM_WINDOWS
|
411
|
-
lib, path = 'GLFW3.dll', Dir.pwd
|
412
|
-
when :OPENGL_PLATFORM_MACOSX
|
413
|
-
lib, path = 'libglfw.dylib', Dir.pwd
|
414
|
-
else
|
415
|
-
lib = 'libglfw.so'
|
416
|
-
end
|
417
|
-
end
|
418
|
-
|
419
|
-
if path
|
420
|
-
dlload (path + '/' + lib)
|
421
|
-
else
|
422
|
-
dlload (lib)
|
423
|
-
end
|
424
|
-
import_symbols() unless @@glfw_import_done
|
425
|
-
end
|
426
|
-
|
427
|
-
def self.load_dll(lib = nil, path = nil)
|
428
|
-
puts "Warning GLFW.load_dll is deprecated, use GLFW.load_lib instead"
|
429
|
-
self.load_lib(lib, path)
|
430
|
-
end
|
431
|
-
|
432
|
-
def self.import_symbols
|
433
|
-
# function
|
434
|
-
extern 'int glfwInit()'
|
435
|
-
extern 'void glfwTerminate()'
|
436
|
-
extern 'void glfwGetVersion(int*, int*, int*)'
|
437
|
-
extern 'const char* glfwGetVersionString()'
|
438
|
-
extern 'void* glfwSetErrorCallback(void*)'
|
439
|
-
extern 'void** glfwGetMonitors(int*)'
|
440
|
-
extern 'void* glfwGetPrimaryMonitor()'
|
441
|
-
extern 'void glfwGetMonitorPos(void*, int*, int*)'
|
442
|
-
extern 'void glfwGetMonitorPhysicalSize(void*, int*, int*)'
|
443
|
-
extern 'const char* glfwGetMonitorName(void*)'
|
444
|
-
extern 'void* glfwSetMonitorCallback(void*)'
|
445
|
-
extern 'const void* glfwGetVideoModes(void*, int*)'
|
446
|
-
extern 'const void* glfwGetVideoMode(void*)'
|
447
|
-
extern 'void glfwSetGamma(void*, float)'
|
448
|
-
extern 'const void* glfwGetGammaRamp(void*)'
|
449
|
-
extern 'void glfwSetGammaRamp(void*, const void*)'
|
450
|
-
extern 'void glfwDefaultWindowHints()'
|
451
|
-
extern 'void glfwWindowHint(int, int)'
|
452
|
-
extern 'void* glfwCreateWindow(int, int, const char*, void*, void*)'
|
453
|
-
extern 'void glfwDestroyWindow(void*)'
|
454
|
-
extern 'int glfwWindowShouldClose(void*)'
|
455
|
-
extern 'void glfwSetWindowShouldClose(void* window, int)'
|
456
|
-
extern 'void glfwSetWindowTitle(void*, const char*)'
|
457
|
-
extern 'void glfwGetWindowPos(void*, int*, int*)'
|
458
|
-
extern 'void glfwSetWindowPos(void*, int, int)'
|
459
|
-
extern 'void glfwGetWindowSize(void*, int*, int*)'
|
460
|
-
extern 'void glfwSetWindowSize(void*, int, int)'
|
461
|
-
extern 'void glfwGetFramebufferSize(void*, int*, int*)'
|
462
|
-
extern 'void glfwIconifyWindow(void*)'
|
463
|
-
extern 'void glfwRestoreWindow(void*)'
|
464
|
-
extern 'void glfwShowWindow(void*)'
|
465
|
-
extern 'void glfwHideWindow(void*)'
|
466
|
-
extern 'void* glfwGetWindowMonitor(void*)'
|
467
|
-
extern 'int glfwGetWindowAttrib(void*, int)'
|
468
|
-
extern 'void glfwSetWindowUserPointer(void*, void*)'
|
469
|
-
extern 'void* glfwGetWindowUserPointer(void*)'
|
470
|
-
extern 'void* glfwSetWindowPosCallback(void*, void*)'
|
471
|
-
extern 'void* glfwSetWindowSizeCallback(void*, void*)'
|
472
|
-
extern 'void* glfwSetWindowCloseCallback(void*, void*)'
|
473
|
-
extern 'void* glfwSetWindowRefreshCallback(void*, void*)'
|
474
|
-
extern 'void* glfwSetWindowFocusCallback(void*, void*)'
|
475
|
-
extern 'void* glfwSetWindowIconifyCallback(void*, void*)'
|
476
|
-
extern 'void* glfwSetFramebufferSizeCallback(void*, void*)'
|
477
|
-
extern 'void glfwPollEvents()'
|
478
|
-
extern 'void glfwWaitEvents()'
|
479
|
-
extern 'int glfwGetInputMode(void*, int)'
|
480
|
-
extern 'void glfwSetInputMode(void*, int, int)'
|
481
|
-
extern 'int glfwGetKey(void*, int)'
|
482
|
-
extern 'int glfwGetMouseButton(void*, int)'
|
483
|
-
extern 'void glfwGetCursorPos(void*, double*, double*)'
|
484
|
-
extern 'void glfwSetCursorPos(void*, double, double)'
|
485
|
-
extern 'void* glfwSetKeyCallback(void*, void*)'
|
486
|
-
extern 'void* glfwSetCharCallback(void*, void*)'
|
487
|
-
extern 'void* glfwSetMouseButtonCallback(void*, void*)'
|
488
|
-
extern 'void* glfwSetCursorPosCallback(void*, void*)'
|
489
|
-
extern 'void* glfwSetCursorEnterCallback(void*, void*)'
|
490
|
-
extern 'void* glfwSetScrollCallback(void*, void*)'
|
491
|
-
extern 'int glfwJoystickPresent(int)'
|
492
|
-
extern 'const float* glfwGetJoystickAxes(int, int*)'
|
493
|
-
extern 'const unsigned char* glfwGetJoystickButtons(int, int*)'
|
494
|
-
extern 'const char* glfwGetJoystickName(int)'
|
495
|
-
extern 'void glfwSetClipboardString(void*, const char*)'
|
496
|
-
extern 'const char* glfwGetClipboardString(void*)'
|
497
|
-
extern 'double glfwGetTime()'
|
498
|
-
extern 'void glfwSetTime(double)'
|
499
|
-
extern 'void glfwMakeContextCurrent(void*)'
|
500
|
-
extern 'void* glfwGetCurrentContext()'
|
501
|
-
extern 'void glfwSwapBuffers(void*)'
|
502
|
-
extern 'void glfwSwapInterval(int)'
|
503
|
-
extern 'int glfwExtensionSupported(const char*)'
|
504
|
-
extern 'void* glfwGetProcAddress(const char*)'
|
505
|
-
|
506
|
-
@@glfw_import_done = true
|
507
|
-
end
|
508
|
-
|
509
|
-
end
|