opengl-bindings 1.6.9 → 1.6.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aa3a9dad84f15e6d33769dafb28126e0697838ded275220ad06c23ff6c82d4a4
4
- data.tar.gz: 8e5b0487cc2339ecfa99ed468f10b3f40ec45e118c29d141fb21dd410c8fde80
3
+ metadata.gz: fda2806a819128a2b44f2b26ba0af6c37181269c3285083e3862c345856f343f
4
+ data.tar.gz: 55f72d322131fa7c9883cddfb6be539eab7f1f2c1cbb4f2d9abd3b61c1cb4bfc
5
5
  SHA512:
6
- metadata.gz: 138c40519679e3a32a52a77dfa7f1fadcbb7e450cf8b7f06bc70ad3ac3540e2e798e57d383f42da104b919370000f5367cf13fba319b597ccbfa7a4daacac9b8
7
- data.tar.gz: f834dc76012d582d2c431aa71d53eef584271e8488ec84d46b1393605bae55204f99ba4b625dc1995a5b482c2f04546f72d84a69f99d6de22d8674abe3a175d3
6
+ metadata.gz: 06a30753faccabc985bf83efb274c632e704ebd50f82bf6bdb018089377597c7ff4b5eb3867eada481716322a746dbb284bec028ed12b1a2c2ddb65428f8cdd2
7
+ data.tar.gz: 74071271769f4c66620ded48dcbe9402bc9661779a18aefc5d1408b3bf5ffa61659c24bdd0053fa89993c88890e159f011e8e85906b6c09aaa7f95605f34a69a
data/ChangeLog CHANGED
@@ -1,3 +1,35 @@
1
+ 2020-04-25 vaiorabbit <http://twitter.com/vaiorabbit>
2
+
3
+ * Updated using latest gl.xml.
4
+
5
+ 2020-03-14 vaiorabbit <http://twitter.com/vaiorabbit>
6
+
7
+ * Updated using latest gl.xml.
8
+
9
+ 2020-01-26 vaiorabbit <http://twitter.com/vaiorabbit>
10
+
11
+ * Updated using latest gl.xml.
12
+
13
+ 2019-11-24 vaiorabbit <http://twitter.com/vaiorabbit>
14
+
15
+ * Updated using latest gl.xml.
16
+
17
+ 2019-10-25 vaiorabbit <http://twitter.com/vaiorabbit>
18
+
19
+ * Updated using latest gl.xml.
20
+
21
+ 2019-09-01 vaiorabbit <http://twitter.com/vaiorabbit>
22
+
23
+ * Updated using latest gl.xml.
24
+
25
+ 2019-07-28 vaiorabbit <http://twitter.com/vaiorabbit>
26
+
27
+ * Updated using latest gl.xml.
28
+
29
+ 2019-06-09 vaiorabbit <http://twitter.com/vaiorabbit>
30
+
31
+ * Updated using latest gl.xml.
32
+
1
33
  2019-04-28 vaiorabbit <http://twitter.com/vaiorabbit>
2
34
 
3
35
  * glfw.rb: Added GLFW 3.3 features.
@@ -1,5 +1,5 @@
1
1
  Ruby-OpenGL : Yet another OpenGL wrapper for Ruby (and wrapper code generator)
2
- Copyright (c) 2013-2019 vaiorabbit <http://twitter.com/vaiorabbit>
2
+ Copyright (c) 2013-2020 vaiorabbit <http://twitter.com/vaiorabbit>
3
3
 
4
4
  This software is provided 'as-is', without any express or implied
5
5
  warranty. In no event will the authors be held liable for any damages
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  ...and wrapper code generator.
6
6
 
7
7
  * Created : 2013-08-28
8
- * Last modified : 2019-04-28
8
+ * Last modified : 2020-04-25
9
9
 
10
10
  [![Gem Version](https://badge.fury.io/rb/opengl-bindings.svg)](https://badge.fury.io/rb/opengl-bindings) [![Gem](https://img.shields.io/gem/dt/opengl-bindings.svg)](opengl-bindings)
11
11
 
@@ -108,6 +108,8 @@ Use GLFW or GLUT for creating windows and OpenGL rendering contexts.
108
108
  ## Tested Environment ##
109
109
 
110
110
  * Ruby
111
+ * ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x64-mingw32]
112
+ * ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19]
111
113
  * ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]
112
114
  * ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-darwin18]
113
115
  * ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-darwin18]
@@ -129,6 +131,16 @@ Use GLFW or GLUT for creating windows and OpenGL rendering contexts.
129
131
  * ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-darwin13.0.0]
130
132
  * ruby 2.0.0p247 (2013-06-27) [i386-mingw32]
131
133
 
134
+ * Windows 10 Home, 64-bit (Version 1909, OS Build 18363.778)
135
+ * NVIDIA GeForce RTX 2060 SUPER
136
+ * OpenGL 4.5
137
+
138
+ > ruby report_env.rb
139
+ Version : 4.5.0 NVIDIA 436.30
140
+ Vendor : NVIDIA Corporation
141
+ Renderer : GeForce RTX 2060 SUPER/PCIe/SSE2
142
+ Shader : 4.50 NVIDIA
143
+
132
144
  * Windows 10 Home, 64-bit (Version 1511, OS Build 10586.164)
133
145
  * NVIDIA GeForce GTX 960
134
146
  * OpenGL 4.5
@@ -164,6 +176,16 @@ Use GLFW or GLUT for creating windows and OpenGL rendering contexts.
164
176
  $ ruby report_env.rb
165
177
  Version: 4.1 INTEL-10.6.33
166
178
 
179
+ * Mac OS X 10.15.3, 64-bit
180
+ * Intel Iris on Mac mini (Late 2014)
181
+ * OpenGL 4.1
182
+
183
+ $ ruby report_env.rb
184
+ Version : 4.1 INTEL-14.4.23
185
+ Vendor : Intel Inc.
186
+ Renderer : Intel Iris OpenGL Engine
187
+ Shader : 4.10
188
+
167
189
  * Arch Linux kernel 4.1.2-2-ARCH, Nvidia Driver, x86_64
168
190
  * NVIDIA GeForce GTS 450
169
191
  * OpenGL 4.5.0
@@ -219,6 +241,8 @@ Use GLFW or GLUT for creating windows and OpenGL rendering contexts.
219
241
  * https://github.com/vaiorabbit/ruby-opencl
220
242
  * perfume_dance - A BVH motion parser and playback implementation written in Ruby
221
243
  * https://github.com/vaiorabbit/perfume_dance
244
+ * open.gl.rb - A port of the https://open.gl/ tutorials to Ruby
245
+ * https://github.com/mechazoidal/opendotgl_rb
222
246
 
223
247
  * Other informative projects
224
248
  * argon | neon
@@ -230,7 +254,7 @@ Use GLFW or GLUT for creating windows and OpenGL rendering contexts.
230
254
 
231
255
  The zlib/libpng License ( http://opensource.org/licenses/Zlib ).
232
256
 
233
- Copyright (c) 2013-2019 vaiorabbit <http://twitter.com/vaiorabbit>
257
+ Copyright (c) 2013-2020 vaiorabbit <http://twitter.com/vaiorabbit>
234
258
 
235
259
  This software is provided 'as-is', without any express or implied
236
260
  warranty. In no event will the authors be held liable for any damages
@@ -353,6 +377,8 @@ GLFW か GLUT を用意してください。ウィンドウやレンダリング
353
377
  ## テストした環境 ##
354
378
 
355
379
  * Ruby
380
+ * ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x64-mingw32]
381
+ * ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19]
356
382
  * ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]
357
383
  * ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-darwin18]
358
384
  * ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-darwin18]
@@ -374,6 +400,16 @@ GLFW か GLUT を用意してください。ウィンドウやレンダリング
374
400
  * ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-darwin13.0.0]
375
401
  * ruby 2.0.0p247 (2013-06-27) [i386-mingw32]
376
402
 
403
+ * Windows 10 Home, 64-bit (Version 1909, OS Build 18363.778)
404
+ * NVIDIA GeForce RTX 2060 SUPER
405
+ * OpenGL 4.5
406
+
407
+ > ruby report_env.rb
408
+ Version : 4.5.0 NVIDIA 436.30
409
+ Vendor : NVIDIA Corporation
410
+ Renderer : GeForce RTX 2060 SUPER/PCIe/SSE2
411
+ Shader : 4.50 NVIDIA
412
+
377
413
  * Windows 10 Home, 64-bit (Version 1511, OS Build 10586.164)
378
414
  * NVIDIA GeForce GTX 960
379
415
  * OpenGL 4.5
@@ -402,6 +438,16 @@ GLFW か GLUT を用意してください。ウィンドウやレンダリング
402
438
  $ ruby report_env.rb
403
439
  Version: 4.1 INTEL-10.6.33
404
440
 
441
+ * Mac OS X 10.15.3, 64-bit
442
+ * Intel Iris on Mac mini (Late 2014)
443
+ * OpenGL 4.1
444
+
445
+ $ ruby report_env.rb
446
+ Version : 4.1 INTEL-14.4.23
447
+ Vendor : Intel Inc.
448
+ Renderer : Intel Iris OpenGL Engine
449
+ Shader : 4.10
450
+
405
451
  * Arch Linux kernel 4.1.2-2-ARCH, Nvidia Driver, x86_64
406
452
  * NVIDIA GeForce GTS 450
407
453
  * OpenGL 4.5.0
@@ -458,6 +504,8 @@ GLFW か GLUT を用意してください。ウィンドウやレンダリング
458
504
  * https://github.com/vaiorabbit/ruby-opencl
459
505
  * perfume_dance - A BVH motion parser and playback implementation written in Ruby
460
506
  * https://github.com/vaiorabbit/perfume_dance
507
+ * open.gl.rb - A port of the https://open.gl/ tutorials to Ruby
508
+ * https://github.com/mechazoidal/opendotgl_rb
461
509
 
462
510
  * 参考になりそうなプロジェクト
463
511
  * argon | neon
@@ -667,7 +667,7 @@ end
667
667
 
668
668
  =begin
669
669
  Ruby-OpenGL : Yet another OpenGL wrapper for Ruby (and wrapper code generator)
670
- Copyright (c) 2013-2019 vaiorabbit <http://twitter.com/vaiorabbit>
670
+ Copyright (c) 2013-2020 vaiorabbit <http://twitter.com/vaiorabbit>
671
671
 
672
672
  This software is provided 'as-is', without any express or implied
673
673
  warranty. In no event will the authors be held liable for any damages
@@ -0,0 +1,594 @@
1
+ # -*- coding: utf-8 -*-
2
+ # A GLFW wrapper (for version 3.0, 3.1 and 3.2)
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_TRUE = 1 # Available since GLFW 3.2
39
+ GLFW_FALSE = 0 # Available since GLFW 3.2
40
+
41
+ GLFW_RELEASE = 0
42
+ GLFW_PRESS = 1
43
+ GLFW_REPEAT = 2
44
+
45
+ GLFW_KEY_UNKNOWN = -1
46
+
47
+ GLFW_KEY_SPACE = 32
48
+ GLFW_KEY_APOSTROPHE = 39 # '
49
+ GLFW_KEY_COMMA = 44 # ,
50
+ GLFW_KEY_MINUS = 45 # -
51
+ GLFW_KEY_PERIOD = 46 # .
52
+ GLFW_KEY_SLASH = 47 # /
53
+ GLFW_KEY_0 = 48
54
+ GLFW_KEY_1 = 49
55
+ GLFW_KEY_2 = 50
56
+ GLFW_KEY_3 = 51
57
+ GLFW_KEY_4 = 52
58
+ GLFW_KEY_5 = 53
59
+ GLFW_KEY_6 = 54
60
+ GLFW_KEY_7 = 55
61
+ GLFW_KEY_8 = 56
62
+ GLFW_KEY_9 = 57
63
+ GLFW_KEY_SEMICOLON = 59 # ;
64
+ GLFW_KEY_EQUAL = 61 # =
65
+ GLFW_KEY_A = 65
66
+ GLFW_KEY_B = 66
67
+ GLFW_KEY_C = 67
68
+ GLFW_KEY_D = 68
69
+ GLFW_KEY_E = 69
70
+ GLFW_KEY_F = 70
71
+ GLFW_KEY_G = 71
72
+ GLFW_KEY_H = 72
73
+ GLFW_KEY_I = 73
74
+ GLFW_KEY_J = 74
75
+ GLFW_KEY_K = 75
76
+ GLFW_KEY_L = 76
77
+ GLFW_KEY_M = 77
78
+ GLFW_KEY_N = 78
79
+ GLFW_KEY_O = 79
80
+ GLFW_KEY_P = 80
81
+ GLFW_KEY_Q = 81
82
+ GLFW_KEY_R = 82
83
+ GLFW_KEY_S = 83
84
+ GLFW_KEY_T = 84
85
+ GLFW_KEY_U = 85
86
+ GLFW_KEY_V = 86
87
+ GLFW_KEY_W = 87
88
+ GLFW_KEY_X = 88
89
+ GLFW_KEY_Y = 89
90
+ GLFW_KEY_Z = 90
91
+ GLFW_KEY_LEFT_BRACKET = 91 # [
92
+ GLFW_KEY_BACKSLASH = 92 # \
93
+ GLFW_KEY_RIGHT_BRACKET = 93 # ]
94
+ GLFW_KEY_GRAVE_ACCENT = 96 # `
95
+ GLFW_KEY_WORLD_1 = 161 # non-US #1
96
+ GLFW_KEY_WORLD_2 = 162 # non-US #2
97
+
98
+ GLFW_KEY_ESCAPE = 256
99
+ GLFW_KEY_ENTER = 257
100
+ GLFW_KEY_TAB = 258
101
+ GLFW_KEY_BACKSPACE = 259
102
+ GLFW_KEY_INSERT = 260
103
+ GLFW_KEY_DELETE = 261
104
+ GLFW_KEY_RIGHT = 262
105
+ GLFW_KEY_LEFT = 263
106
+ GLFW_KEY_DOWN = 264
107
+ GLFW_KEY_UP = 265
108
+ GLFW_KEY_PAGE_UP = 266
109
+ GLFW_KEY_PAGE_DOWN = 267
110
+ GLFW_KEY_HOME = 268
111
+ GLFW_KEY_END = 269
112
+ GLFW_KEY_CAPS_LOCK = 280
113
+ GLFW_KEY_SCROLL_LOCK = 281
114
+ GLFW_KEY_NUM_LOCK = 282
115
+ GLFW_KEY_PRINT_SCREEN = 283
116
+ GLFW_KEY_PAUSE = 284
117
+ GLFW_KEY_F1 = 290
118
+ GLFW_KEY_F2 = 291
119
+ GLFW_KEY_F3 = 292
120
+ GLFW_KEY_F4 = 293
121
+ GLFW_KEY_F5 = 294
122
+ GLFW_KEY_F6 = 295
123
+ GLFW_KEY_F7 = 296
124
+ GLFW_KEY_F8 = 297
125
+ GLFW_KEY_F9 = 298
126
+ GLFW_KEY_F10 = 299
127
+ GLFW_KEY_F11 = 300
128
+ GLFW_KEY_F12 = 301
129
+ GLFW_KEY_F13 = 302
130
+ GLFW_KEY_F14 = 303
131
+ GLFW_KEY_F15 = 304
132
+ GLFW_KEY_F16 = 305
133
+ GLFW_KEY_F17 = 306
134
+ GLFW_KEY_F18 = 307
135
+ GLFW_KEY_F19 = 308
136
+ GLFW_KEY_F20 = 309
137
+ GLFW_KEY_F21 = 310
138
+ GLFW_KEY_F22 = 311
139
+ GLFW_KEY_F23 = 312
140
+ GLFW_KEY_F24 = 313
141
+ GLFW_KEY_F25 = 314
142
+ GLFW_KEY_KP_0 = 320
143
+ GLFW_KEY_KP_1 = 321
144
+ GLFW_KEY_KP_2 = 322
145
+ GLFW_KEY_KP_3 = 323
146
+ GLFW_KEY_KP_4 = 324
147
+ GLFW_KEY_KP_5 = 325
148
+ GLFW_KEY_KP_6 = 326
149
+ GLFW_KEY_KP_7 = 327
150
+ GLFW_KEY_KP_8 = 328
151
+ GLFW_KEY_KP_9 = 329
152
+ GLFW_KEY_KP_DECIMAL = 330
153
+ GLFW_KEY_KP_DIVIDE = 331
154
+ GLFW_KEY_KP_MULTIPLY = 332
155
+ GLFW_KEY_KP_SUBTRACT = 333
156
+ GLFW_KEY_KP_ADD = 334
157
+ GLFW_KEY_KP_ENTER = 335
158
+ GLFW_KEY_KP_EQUAL = 336
159
+ GLFW_KEY_LEFT_SHIFT = 340
160
+ GLFW_KEY_LEFT_CONTROL = 341
161
+ GLFW_KEY_LEFT_ALT = 342
162
+ GLFW_KEY_LEFT_SUPER = 343
163
+ GLFW_KEY_RIGHT_SHIFT = 344
164
+ GLFW_KEY_RIGHT_CONTROL = 345
165
+ GLFW_KEY_RIGHT_ALT = 346
166
+ GLFW_KEY_RIGHT_SUPER = 347
167
+ GLFW_KEY_MENU = 348
168
+ GLFW_KEY_LAST = GLFW_KEY_MENU
169
+
170
+ GLFW_MOD_SHIFT = 0x0001
171
+ GLFW_MOD_CONTROL = 0x0002
172
+ GLFW_MOD_ALT = 0x0004
173
+ GLFW_MOD_SUPER = 0x0008
174
+
175
+ GLFW_MOUSE_BUTTON_1 = 0
176
+ GLFW_MOUSE_BUTTON_2 = 1
177
+ GLFW_MOUSE_BUTTON_3 = 2
178
+ GLFW_MOUSE_BUTTON_4 = 3
179
+ GLFW_MOUSE_BUTTON_5 = 4
180
+ GLFW_MOUSE_BUTTON_6 = 5
181
+ GLFW_MOUSE_BUTTON_7 = 6
182
+ GLFW_MOUSE_BUTTON_8 = 7
183
+ GLFW_MOUSE_BUTTON_LAST = GLFW_MOUSE_BUTTON_8
184
+ GLFW_MOUSE_BUTTON_LEFT = GLFW_MOUSE_BUTTON_1
185
+ GLFW_MOUSE_BUTTON_RIGHT = GLFW_MOUSE_BUTTON_2
186
+ GLFW_MOUSE_BUTTON_MIDDLE = GLFW_MOUSE_BUTTON_3
187
+
188
+ GLFW_JOYSTICK_1 = 0
189
+ GLFW_JOYSTICK_2 = 1
190
+ GLFW_JOYSTICK_3 = 2
191
+ GLFW_JOYSTICK_4 = 3
192
+ GLFW_JOYSTICK_5 = 4
193
+ GLFW_JOYSTICK_6 = 5
194
+ GLFW_JOYSTICK_7 = 6
195
+ GLFW_JOYSTICK_8 = 7
196
+ GLFW_JOYSTICK_9 = 8
197
+ GLFW_JOYSTICK_10 = 9
198
+ GLFW_JOYSTICK_11 = 10
199
+ GLFW_JOYSTICK_12 = 11
200
+ GLFW_JOYSTICK_13 = 12
201
+ GLFW_JOYSTICK_14 = 13
202
+ GLFW_JOYSTICK_15 = 14
203
+ GLFW_JOYSTICK_16 = 15
204
+ GLFW_JOYSTICK_LAST = GLFW_JOYSTICK_16
205
+
206
+ GLFW_NOT_INITIALIZED = 0x00010001
207
+ GLFW_NO_CURRENT_CONTEXT = 0x00010002
208
+ GLFW_INVALID_ENUM = 0x00010003
209
+ GLFW_INVALID_VALUE = 0x00010004
210
+ GLFW_OUT_OF_MEMORY = 0x00010005
211
+ GLFW_API_UNAVAILABLE = 0x00010006
212
+ GLFW_VERSION_UNAVAILABLE = 0x00010007
213
+ GLFW_PLATFORM_ERROR = 0x00010008
214
+ GLFW_FORMAT_UNAVAILABLE = 0x00010009
215
+ GLFW_NO_WINDOW_CONTEXT = 0x0001000A # Available since GLFW 3.2
216
+
217
+ GLFW_FOCUSED = 0x00020001
218
+ GLFW_ICONIFIED = 0x00020002
219
+ GLFW_RESIZABLE = 0x00020003
220
+ GLFW_VISIBLE = 0x00020004
221
+ GLFW_DECORATED = 0x00020005
222
+ GLFW_AUTO_ICONIFY = 0x00020006 # Available since GLFW 3.1
223
+ GLFW_FLOATING = 0x00020007 # Available since GLFW 3.1
224
+ GLFW_MAXIMIZED = 0x00020008 # Available since GLFW 3.2
225
+
226
+ GLFW_RED_BITS = 0x00021001
227
+ GLFW_GREEN_BITS = 0x00021002
228
+ GLFW_BLUE_BITS = 0x00021003
229
+ GLFW_ALPHA_BITS = 0x00021004
230
+ GLFW_DEPTH_BITS = 0x00021005
231
+ GLFW_STENCIL_BITS = 0x00021006
232
+ GLFW_ACCUM_RED_BITS = 0x00021007
233
+ GLFW_ACCUM_GREEN_BITS = 0x00021008
234
+ GLFW_ACCUM_BLUE_BITS = 0x00021009
235
+ GLFW_ACCUM_ALPHA_BITS = 0x0002100A
236
+ GLFW_AUX_BUFFERS = 0x0002100B
237
+ GLFW_STEREO = 0x0002100C
238
+ GLFW_SAMPLES = 0x0002100D
239
+ GLFW_SRGB_CAPABLE = 0x0002100E
240
+ GLFW_REFRESH_RATE = 0x0002100F
241
+ GLFW_DOUBLEBUFFER = 0x00021010
242
+
243
+ GLFW_CLIENT_API = 0x00022001
244
+ GLFW_CONTEXT_VERSION_MAJOR = 0x00022002
245
+ GLFW_CONTEXT_VERSION_MINOR = 0x00022003
246
+ GLFW_CONTEXT_REVISION = 0x00022004
247
+ GLFW_CONTEXT_ROBUSTNESS = 0x00022005
248
+ GLFW_OPENGL_FORWARD_COMPAT = 0x00022006
249
+ GLFW_OPENGL_DEBUG_CONTEXT = 0x00022007
250
+ GLFW_OPENGL_PROFILE = 0x00022008
251
+ GLFW_CONTEXT_RELEASE_BEHAVIOR = 0x00022009
252
+ GLFW_CONTEXT_NO_ERROR = 0x0002200A
253
+ GLFW_CONTEXT_CREATION_API = 0x0002200B # Available since GLFW 3.2
254
+
255
+ GLFW_NO_API = 0 # Available since GLFW 3.2
256
+ GLFW_OPENGL_API = 0x00030001
257
+ GLFW_OPENGL_ES_API = 0x00030002
258
+
259
+ GLFW_NO_ROBUSTNESS = 0
260
+ GLFW_NO_RESET_NOTIFICATION = 0x00031001
261
+ GLFW_LOSE_CONTEXT_ON_RESET = 0x00031002
262
+
263
+ GLFW_OPENGL_ANY_PROFILE = 0
264
+ GLFW_OPENGL_CORE_PROFILE = 0x00032001
265
+ GLFW_OPENGL_COMPAT_PROFILE = 0x00032002
266
+
267
+ GLFW_CURSOR = 0x00033001
268
+ GLFW_STICKY_KEYS = 0x00033002
269
+ GLFW_STICKY_MOUSE_BUTTONS = 0x00033003
270
+
271
+ GLFW_CURSOR_NORMAL = 0x00034001
272
+ GLFW_CURSOR_HIDDEN = 0x00034002
273
+ GLFW_CURSOR_DISABLED = 0x00034003
274
+
275
+ GLFW_ANY_RELEASE_BEHAVIOR = 0
276
+ GLFW_RELEASE_BEHAVIOR_FLUSH = 0x00035001
277
+ GLFW_RELEASE_BEHAVIOR_NONE = 0x00035002
278
+
279
+ GLFW_NATIVE_CONTEXT_API = 0x00036001 # Available since GLFW 3.2
280
+ GLFW_EGL_CONTEXT_API = 0x00036002 # Available since GLFW 3.2
281
+
282
+ GLFW_ARROW_CURSOR = 0x00036001
283
+ GLFW_IBEAM_CURSOR = 0x00036002
284
+ GLFW_CROSSHAIR_CURSOR = 0x00036003
285
+ GLFW_HAND_CURSOR = 0x00036004
286
+ GLFW_HRESIZE_CURSOR = 0x00036005
287
+ GLFW_VRESIZE_CURSOR = 0x00036006
288
+
289
+ GLFW_CONNECTED = 0x00040001
290
+ GLFW_DISCONNECTED = 0x00040002
291
+
292
+ GLFW_DONT_CARE = -1
293
+
294
+ # typedefs
295
+ @@glfw_cb_function_signature = {
296
+ :GLFWerrorfun => "void GLFWerrorfun(int,const char*)",
297
+ :GLFWwindowposfun => "void GLFWwindowposfun(void*,int,int)",
298
+ :GLFWwindowsizefun => "void GLFWwindowsizefun(void*,int,int)",
299
+ :GLFWwindowclosefun => "void GLFWwindowclosefun(void*)",
300
+ :GLFWwindowrefreshfun => "void GLFWwindowrefreshfun(void*)",
301
+ :GLFWwindowfocusfun => "void GLFWwindowfocusfun(void*,int)",
302
+ :GLFWwindowiconifyfun => "void GLFWwindowiconifyfun(void*,int)",
303
+ :GLFWframebuffersizefun => "void GLFWframebuffersizefun(void*,int,int)",
304
+ :GLFWmousebuttonfun => "void GLFWmousebuttonfun(void*,int,int,int)",
305
+ :GLFWcursorposfun => "void GLFWcursorposfun(void*,double,double)",
306
+ :GLFWcursorenterfun => "void GLFWcursorenterfun(void*,int)",
307
+ :GLFWscrollfun => "void GLFWscrollfun(void*,double,double)",
308
+ :GLFWkeyfun => "void GLFWkeyfun(void*,int,int,int,int)",
309
+ :GLFWcharfun => "void GLFWcharfun(void*,unsigned int)",
310
+ :GLFWcharmodsfun => "void GLFWcharmodsfun(void*,unsigned int,int)", # Available since GLFW 3.1
311
+ :GLFWdropfun => "void GLFWdropfun(void*,int,const char**)", # Available since GLFW 3.1
312
+ :GLFWmonitorfun => "void GLFWmonitorfun(void*,int)", # Available since GLFW 3.0
313
+ :GLFWjoystickfun => "void GGLFWjoystickfun(int,int)", # Available since GLFW 3.2
314
+ }
315
+
316
+ # Creates a callback as an instance of Fiddle::Function
317
+ def self.create_callback_function( sym, proc=nil, &blk )
318
+ if block_given?
319
+ return bind( @@glfw_cb_function_signature[sym], nil, &blk )
320
+ else
321
+ return bind( @@glfw_cb_function_signature[sym], nil, &proc )
322
+ end
323
+ end
324
+
325
+ GLFWerrorfun_cb_args = [Fiddle::TYPE_INT, Fiddle::TYPE_VOIDP]
326
+ GLFWerrorfun_cb_retval = Fiddle::TYPE_VOID
327
+ GLFWwindowposfun_cb_args = [Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT, Fiddle::TYPE_INT]
328
+ GLFWwindowposfun_cb_retval = Fiddle::TYPE_VOID
329
+ GLFWwindowsizefun_cb_args = [Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT, Fiddle::TYPE_INT]
330
+ GLFWwindowsizefun_cb_retval = Fiddle::TYPE_VOID
331
+ GLFWwindowclosefun_cb_args = [Fiddle::TYPE_VOIDP]
332
+ GLFWwindowclosefun_cb_retval = Fiddle::TYPE_VOID
333
+ GLFWwindowrefreshfun_cb_args = [Fiddle::TYPE_VOIDP]
334
+ GLFWwindowrefreshfun_cb_retval = Fiddle::TYPE_VOID
335
+ GLFWwindowfocusfun_cb_args = [Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT]
336
+ GLFWwindowfocusfun_cb_retval = Fiddle::TYPE_VOID
337
+ GLFWwindowiconifyfun_cb_args = [Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT]
338
+ GLFWwindowiconifyfun_cb_retval = Fiddle::TYPE_VOID
339
+ GLFWframebuffersizefun_cb_args = [Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT, Fiddle::TYPE_INT]
340
+ GLFWframebuffersizefun_cb_retval = Fiddle::TYPE_VOID
341
+ GLFWmousebuttonfun_cb_args = [Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT, Fiddle::TYPE_INT, Fiddle::TYPE_INT]
342
+ GLFWmousebuttonfun_cb_retval = Fiddle::TYPE_VOID
343
+ GLFWcursorposfun_cb_args = [Fiddle::TYPE_VOIDP, Fiddle::TYPE_DOUBLE, Fiddle::TYPE_DOUBLE]
344
+ GLFWcursorposfun_cb_retval = Fiddle::TYPE_VOID
345
+ GLFWcursorenterfun_cb_args = [Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT]
346
+ GLFWcursorenterfun_cb_retval = Fiddle::TYPE_VOID
347
+ GLFWscrollfun_cb_args = [Fiddle::TYPE_VOIDP, Fiddle::TYPE_DOUBLE, Fiddle::TYPE_DOUBLE]
348
+ GLFWscrollfun_cb_retval = Fiddle::TYPE_VOID
349
+ GLFWkeyfun_cb_args = [Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT, Fiddle::TYPE_INT, Fiddle::TYPE_INT, Fiddle::TYPE_INT]
350
+ GLFWkeyfun_cb_retval = Fiddle::TYPE_VOID
351
+ GLFWcharfun_cb_args = [Fiddle::TYPE_VOIDP, -Fiddle::TYPE_INT]
352
+ GLFWcharfun_cb_retval = Fiddle::TYPE_VOID
353
+ GLFWcharmodsfun_cb_args = [Fiddle::TYPE_VOIDP, -Fiddle::TYPE_INT, Fiddle::TYPE_INT] # Available since GLFW 3.1
354
+ GLFWcharmodsfun_cb_retval = Fiddle::TYPE_VOID # Available since GLFW 3.1
355
+ GLFWdropfun_cb_args = [Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT, Fiddle::TYPE_VOIDP] # Available since GLFW 3.1
356
+ GLFWdropfun_cb_retval = Fiddle::TYPE_VOID # Available since GLFW 3.1
357
+ GLFWmonitorfun_cb_args = [Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT] # Available since GLFW 3.0
358
+ GLFWmonitorfun_cb_retval = Fiddle::TYPE_VOID # Available since GLFW 3.0
359
+ GLFWjoystickfun_cb_args = [Fiddle::TYPE_INT, Fiddle::TYPE_INT] # Available since GLFW 3.2
360
+ GLFWjoystickfun_cb_retval = Fiddle::TYPE_VOID # Available since GLFW 3.2
361
+
362
+ @@glfw_cb_closure_signature = {
363
+ :GLFWerrorfun => [GLFWerrorfun_cb_retval, GLFWerrorfun_cb_args],
364
+ :GLFWwindowposfun => [GLFWwindowposfun_cb_retval, GLFWwindowposfun_cb_args],
365
+ :GLFWwindowsizefun => [GLFWwindowsizefun_cb_retval, GLFWwindowsizefun_cb_args],
366
+ :GLFWwindowclosefun => [GLFWwindowclosefun_cb_retval, GLFWwindowclosefun_cb_args],
367
+ :GLFWwindowrefreshfun => [GLFWwindowrefreshfun_cb_retval, GLFWwindowrefreshfun_cb_args],
368
+ :GLFWwindowfocusfun => [GLFWwindowfocusfun_cb_retval, GLFWwindowfocusfun_cb_args],
369
+ :GLFWwindowiconifyfun => [GLFWwindowiconifyfun_cb_retval, GLFWwindowiconifyfun_cb_args],
370
+ :GLFWframebuffersizefun => [GLFWframebuffersizefun_cb_retval, GLFWframebuffersizefun_cb_args],
371
+ :GLFWmousebuttonfun => [GLFWmousebuttonfun_cb_retval, GLFWmousebuttonfun_cb_args],
372
+ :GLFWcursorposfun => [GLFWcursorposfun_cb_retval, GLFWcursorposfun_cb_args],
373
+ :GLFWcursorenterfun => [GLFWcursorenterfun_cb_retval, GLFWcursorenterfun_cb_args],
374
+ :GLFWscrollfun => [GLFWscrollfun_cb_retval, GLFWscrollfun_cb_args],
375
+ :GLFWkeyfun => [GLFWkeyfun_cb_retval, GLFWkeyfun_cb_args],
376
+ :GLFWcharfun => [GLFWcharfun_cb_retval, GLFWcharfun_cb_args],
377
+ :GLFWcharmodsfun => [GLFWcharmodsfun_cb_retval, GLFWcharmodsfun_cb_args], # Available since GLFW 3.1
378
+ :GLFWdropfun => [GLFWdropfun_cb_retval, GLFWdropfun_cb_args], # Available since GLFW 3.1
379
+ :GLFWmonitorfun => [GLFWmonitorfun_cb_retval, GLFWmonitorfun_cb_args],
380
+ :GLFWjoystickfun => [GLFWjoystickfun_cb_retval, GLFWjoystickfun_cb_args], # Available since GLFW 3.2
381
+ }
382
+
383
+ # Creates a callback as an instance of Fiddle::Closure::BlockCaller
384
+ def self.create_callback_closure( sym, proc=nil, &blk )
385
+ cb_retval = @@glfw_cb_closure_signature[sym][0]
386
+ cb_args = @@glfw_cb_closure_signature[sym][1]
387
+ if block_given?
388
+ return Fiddle::Closure::BlockCaller.new( cb_retval, cb_args, Fiddle::Function::DEFAULT, &blk )
389
+ else
390
+ return Fiddle::Closure::BlockCaller.new( cb_retval, cb_args, Fiddle::Function::DEFAULT, &proc )
391
+ end
392
+ end
393
+
394
+ # NOTE : Use 'create_callback_function' for backward compatibility.
395
+ def self.create_callback( sym, proc=nil, &blk )
396
+ return self.create_callback_closure( sym, proc, &blk )
397
+ end
398
+
399
+ # struct
400
+ GLFWvidmode = struct(["int width",
401
+ "int height",
402
+ "int redBits",
403
+ "int greenBits",
404
+ "int blueBits",
405
+ "int refreshRate"])
406
+
407
+ GLFWgammaramp = struct(["unsigned short* red",
408
+ "unsigned short* green",
409
+ "unsigned short* blue",
410
+ "unsigned int size"])
411
+
412
+ # Available since GLFW 3.1
413
+ GLFWimage = struct(["int width",
414
+ "int height",
415
+ "unsigned char* pixels"])
416
+
417
+ @@glfw_import_done = false
418
+
419
+ # Load native library.
420
+ def self.load_lib(lib = nil, path = nil, output_error = false)
421
+ if lib == nil && path == nil
422
+ case OpenGL.get_platform
423
+ when :OPENGL_PLATFORM_WINDOWS
424
+ lib, path = 'GLFW3.dll', Dir.pwd
425
+ when :OPENGL_PLATFORM_MACOSX
426
+ lib, path = 'libglfw.dylib', Dir.pwd
427
+ else
428
+ lib = 'libglfw.so'
429
+ end
430
+ end
431
+
432
+ if path
433
+ dlload (path + '/' + lib)
434
+ else
435
+ dlload (lib)
436
+ end
437
+ import_symbols(output_error) unless @@glfw_import_done
438
+ end
439
+
440
+ def self.load_dll(lib = nil, path = nil)
441
+ puts "Warning GLFW.load_dll is deprecated, use GLFW.load_lib instead"
442
+ self.load_lib(lib, path)
443
+ end
444
+
445
+ @@lib_signature = [
446
+ 'int glfwInit()',
447
+ 'void glfwTerminate()',
448
+ 'void glfwGetVersion(int*, int*, int*)',
449
+ 'const char* glfwGetVersionString()',
450
+ 'void* glfwSetErrorCallback(void*)',
451
+ 'void** glfwGetMonitors(int*)',
452
+ 'void* glfwGetPrimaryMonitor()',
453
+ 'void glfwGetMonitorPos(void*, int*, int*)',
454
+ 'void glfwGetMonitorPhysicalSize(void*, int*, int*)',
455
+ 'const char* glfwGetMonitorName(void*)',
456
+ 'void* glfwSetMonitorCallback(void*)', # Available since GLFW 3.0
457
+ 'const void* glfwGetVideoModes(void*, int*)',
458
+ 'const void* glfwGetVideoMode(void*)', # Available since GLFW 3.0
459
+ 'void glfwSetGamma(void*, float)', # Available since GLFW 3.0
460
+ 'const void* glfwGetGammaRamp(void*)', # Available since GLFW 3.0
461
+ 'void glfwSetGammaRamp(void*, const void*)', # Available since GLFW 3.0
462
+ 'void glfwDefaultWindowHints()', # Available since GLFW 3.0
463
+ 'void glfwWindowHint(int, int)', # Available since GLFW 3.0
464
+ 'void* glfwCreateWindow(int, int, const char*, void*, void*)', # Available since GLFW 3.0
465
+ 'void glfwDestroyWindow(void*)', # Available since GLFW 3.0
466
+ 'int glfwWindowShouldClose(void*)', # Available since GLFW 3.0
467
+ 'void glfwSetWindowShouldClose(void* window, int)', # Available since GLFW 3.0
468
+ 'void glfwSetWindowTitle(void*, const char*)',
469
+ 'void glfwSetWindowIcon(void*, int, void*)', # Available since GLFW 3.2
470
+ 'void glfwGetWindowPos(void*, int*, int*)', # Available since GLFW 3.0
471
+ 'void glfwSetWindowPos(void*, int, int)',
472
+ 'void glfwGetWindowSize(void*, int*, int*)',
473
+ 'void glfwSetWindowSizeLimits(void*, int, int, int, int)', # Available since GLFW 3.2
474
+ 'void glfwSetWindowAspectRatio(void*, int, int)', # Available since GLFW 3.2
475
+ 'void glfwSetWindowSize(void*, int, int)',
476
+ 'void glfwGetFramebufferSize(void*, int*, int*)', # Available since GLFW 3.0
477
+ 'void glfwGetWindowFrameSize(void*, int*, int*, int*, int*)', # Available since GLFW 3.1
478
+ 'void glfwIconifyWindow(void*)',
479
+ 'void glfwRestoreWindow(void*)',
480
+ 'void glfwMaximizeWindow(void*)', # Available since GLFW 3.2
481
+ 'void glfwShowWindow(void*)', # Available since GLFW 3.0
482
+ 'void glfwHideWindow(void*)', # Available since GLFW 3.0
483
+ 'void glfwFocusWindow(void*)', # Available since GLFW 3.2
484
+ 'void* glfwGetWindowMonitor(void*)', # Available since GLFW 3.0
485
+ 'void glfwSetWindowMonitor(void*, void*, int, int, int, int, int)', # Available since GLFW 3.2
486
+ 'int glfwGetWindowAttrib(void*, int)', # Available since GLFW 3.0
487
+ 'void glfwSetWindowUserPointer(void*, void*)', # Available since GLFW 3.0
488
+ 'void* glfwGetWindowUserPointer(void*)', # Available since GLFW 3.0
489
+ 'void* glfwSetWindowPosCallback(void*, void*)', # Available since GLFW 3.0
490
+ 'void* glfwSetWindowSizeCallback(void*, void*)',
491
+ 'void* glfwSetWindowCloseCallback(void*, void*)',
492
+ 'void* glfwSetWindowRefreshCallback(void*, void*)',
493
+ 'void* glfwSetWindowFocusCallback(void*, void*)', # Available since GLFW 3.0
494
+ 'void* glfwSetWindowIconifyCallback(void*, void*)', # Available since GLFW 3.0
495
+ 'void* glfwSetFramebufferSizeCallback(void*, void*)', # Available since GLFW 3.0
496
+ 'void glfwPollEvents()',
497
+ 'void glfwWaitEvents()',
498
+ 'void glfwWaitEventsTimeout(double)', # Available since GLFW 3.2
499
+ 'void glfwPostEmptyEvent()', # Available since GLFW 3.1
500
+ 'int glfwGetInputMode(void*, int)', # Available since GLFW 3.0
501
+ 'void glfwSetInputMode(void*, int, int)', # Available since GLFW 3.0
502
+ 'const char* glfwGetKeyName(int, int)', # Available since GLFW 3.2
503
+ 'int glfwGetKey(void*, int)',
504
+ 'int glfwGetMouseButton(void*, int)',
505
+ 'void glfwGetCursorPos(void*, double*, double*)', # Available since GLFW 3.0
506
+ 'void glfwSetCursorPos(void*, double, double)', # Available since GLFW 3.0
507
+ 'void* glfwCreateCursor(void*, int, int)', # Available since GLFW 3.1
508
+ 'void* glfwCreateStandardCursor(int)', # Available since GLFW 3.1
509
+ 'void glfwDestroyCursor(void*)', # Available since GLFW 3.1
510
+ 'void glfwSetCursor(void*, void*)', # Available since GLFW 3.1
511
+ 'void* glfwSetKeyCallback(void*, void*)',
512
+ 'void* glfwSetCharCallback(void*, void*)',
513
+ 'void* glfwSetCharModsCallback(void*, void*)', # Available since GLFW 3.1
514
+ 'void* glfwSetMouseButtonCallback(void*, void*)',
515
+ 'void* glfwSetCursorPosCallback(void*, void*)', # Available since GLFW 3.0
516
+ 'void* glfwSetCursorEnterCallback(void*, void*)', # Available since GLFW 3.0
517
+ 'void* glfwSetScrollCallback(void*, void*)', # Available since GLFW 3.0
518
+ 'void* glfwSetDropCallback(void*, void*)', # Available since GLFW 3.1
519
+ 'int glfwJoystickPresent(int)', # Available since GLFW 3.0
520
+ 'const float* glfwGetJoystickAxes(int, int*)', # Available since GLFW 3.0
521
+ 'const unsigned char* glfwGetJoystickButtons(int, int*)',
522
+ 'const char* glfwGetJoystickName(int)', # Available since GLFW 3.0
523
+ 'void* glfwSetJoystickCallback(void*)', # Available since GLFW 3.2
524
+ 'void glfwSetClipboardString(void*, const char*)', # Available since GLFW 3.0
525
+ 'const char* glfwGetClipboardString(void*)', # Available since GLFW 3.0
526
+ 'double glfwGetTime()',
527
+ 'void glfwSetTime(double)',
528
+ 'GLFWuint64 glfwGetTimerValue()', # Available since GLFW 3.2
529
+ 'GLFWuint64 glfwGetTimerFrequency()', # Available since GLFW 3.2
530
+ 'void glfwMakeContextCurrent(void*)', # Available since GLFW 3.0
531
+ 'void* glfwGetCurrentContext()', # Available since GLFW 3.0
532
+ 'void glfwSwapBuffers(void*)',
533
+ 'void glfwSwapInterval(int)',
534
+ 'int glfwExtensionSupported(const char*)',
535
+ 'void* glfwGetProcAddress(const char*)',
536
+ # >>> Vulkan >>>
537
+ 'int glfwVulkanSupported()', # Available since GLFW 3.2
538
+ 'const char** glfwGetRequiredInstanceExtensions(unsigned int*)', # Available since GLFW 3.2
539
+ # 'GLFWvkproc glfwGetInstanceProcAddress(void*, const char*)',
540
+ # 'int glfwGetPhysicalDevicePresentationSupport(void*, void*, unsigned int)',
541
+ # 'VkResult glfwCreateWindowSurface(void*, void*, const void*, void*)',
542
+ # <<< Vulkan <<<
543
+ ]
544
+
545
+ def self.import_symbols(output_error = false)
546
+ typealias 'GLFWuint64', 'unsigned long long' # Available since GLFW 3.2
547
+
548
+ # function
549
+ @@lib_signature.each do |sig|
550
+ begin
551
+ extern sig
552
+ rescue
553
+ $stderr.puts("[Warning] Failed to import #{sig}.") if output_error
554
+ end
555
+ end
556
+
557
+ ver_major = ' ' * 4
558
+ ver_minor = ' ' * 4
559
+ ver_rev = ' ' * 4
560
+ glfwGetVersion(ver_major, ver_minor, ver_rev)
561
+
562
+ GLFW.const_set('GLFW_VERSION_MAJOR', ver_major.unpack('L')[0])
563
+ GLFW.const_set('GLFW_VERSION_MINOR', ver_minor.unpack('L')[0])
564
+ GLFW.const_set('GLFW_VERSION_REVISION', ver_rev.unpack('L')[0])
565
+
566
+ @@glfw_import_done = true
567
+ end
568
+
569
+ end
570
+
571
+ =begin
572
+ Ruby-OpenGL : Yet another OpenGL wrapper for Ruby (and wrapper code generator)
573
+ Copyright (c) 2013-2020 vaiorabbit <http://twitter.com/vaiorabbit>
574
+
575
+ This software is provided 'as-is', without any express or implied
576
+ warranty. In no event will the authors be held liable for any damages
577
+ arising from the use of this software.
578
+
579
+ Permission is granted to anyone to use this software for any purpose,
580
+ including commercial applications, and to alter it and redistribute it
581
+ freely, subject to the following restrictions:
582
+
583
+ 1. The origin of this software must not be misrepresented; you must not
584
+ claim that you wrote the original software. If you use this software
585
+ in a product, an acknowledgment in the product documentation would be
586
+ appreciated but is not required.
587
+
588
+ 2. Altered source versions must be plainly marked as such, and must not be
589
+ misrepresented as being the original software.
590
+
591
+ 3. This notice may not be removed or altered from any source
592
+ distribution.
593
+ =end
594
+