opengl-bindings 1.5.3 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5fb7f2c48167f3a254b85696ee20f6a0fa536bf1
|
4
|
+
data.tar.gz: 74fc8b5851ada1b1e17351ada899ba179eb766a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d08b27e050d05feb3b9dec504fdd2b80ac67f5fdde4590c44008338b875a2ac85ebf1cd705bd4dce8cec7b4b6def560c7b7e68a9e3244e6d20cbd2a546850c06
|
7
|
+
data.tar.gz: 34a01c564079675ab602ad9ac3147ef3e63be6470614e067dcba3dea413975a3c7f2b95b0229d8afb45afefc64420ac05a3afe89d9f7b5555cc5a7e9e0fd3c51
|
data/ChangeLog
CHANGED
@@ -1,3 +1,68 @@
|
|
1
|
+
2016-06-03 vaiorabbit <http://twitter.com/vaiorabbit>
|
2
|
+
|
3
|
+
* opengl-bindings.gemspec: Fixed invalid license value (zlib/libpng -> Zlib). See http://spdx.org/licenses .
|
4
|
+
* sample/glfw32_build_dylib.sh: GLFW 3.2 build script for Mac OS X.
|
5
|
+
|
6
|
+
2016-06-01 vaiorabbit <http://twitter.com/vaiorabbit>
|
7
|
+
|
8
|
+
* Updated using latest gl.xml.
|
9
|
+
|
10
|
+
2016-05-26 vaiorabbit <http://twitter.com/vaiorabbit>
|
11
|
+
|
12
|
+
* Updated using latest gl.xml.
|
13
|
+
|
14
|
+
2016-05-05 vaiorabbit <http://twitter.com/vaiorabbit>
|
15
|
+
|
16
|
+
* glfw.rb: Added GLFW 3.2 features.
|
17
|
+
|
18
|
+
2016-04-22 vaiorabbit <http://twitter.com/vaiorabbit>
|
19
|
+
|
20
|
+
* sample/Gosu/lesson01.rb: Added.
|
21
|
+
|
22
|
+
2016-04-20 vaiorabbit <http://twitter.com/vaiorabbit>
|
23
|
+
|
24
|
+
* Updated using latest gl.xml.
|
25
|
+
|
26
|
+
2016-04-12 vaiorabbit <http://twitter.com/vaiorabbit>
|
27
|
+
|
28
|
+
* Updated using latest gl.xml.
|
29
|
+
* lib/glfw.rb: Now usable for GLFW 3.0, 3.1 and 3.2.
|
30
|
+
* lib/glfw30.rb, lib/glfw31.rb, lib/glfw32.rb: Removed.
|
31
|
+
|
32
|
+
2016-04-11 vaiorabbit <http://twitter.com/vaiorabbit>
|
33
|
+
|
34
|
+
* Updated using latest gl.xml.
|
35
|
+
|
36
|
+
2016-04-09 vaiorabbit <http://twitter.com/vaiorabbit>
|
37
|
+
|
38
|
+
* README.md: Tested on Windows 10 and NVIDIA GeForce GTX 960.
|
39
|
+
|
40
|
+
2016-04-08 vaiorabbit <http://twitter.com/vaiorabbit>
|
41
|
+
|
42
|
+
* glfw.rb: Just an alias of glfw.rb.
|
43
|
+
* glfw32.rb: GLFW binding for version 3.2 (renamed from previous glfw.rb).
|
44
|
+
|
45
|
+
2016-04-01 vaiorabbit <http://twitter.com/vaiorabbit>
|
46
|
+
|
47
|
+
* glfw.rb: Added GLFW 3.2 features.
|
48
|
+
|
49
|
+
2016-03-22 vaiorabbit <http://twitter.com/vaiorabbit>
|
50
|
+
|
51
|
+
* glfw.rb: Added GLFW 3.2 features.
|
52
|
+
* glfw31.rb: Previous version of 'glfw.rb' is available as 'glfw31.rb'.
|
53
|
+
|
54
|
+
2016-02-06 vaiorabbit <http://twitter.com/vaiorabbit>
|
55
|
+
|
56
|
+
* README.md: Added projects using this gem.
|
57
|
+
|
58
|
+
2016-01-09 vaiorabbit <http://twitter.com/vaiorabbit>
|
59
|
+
|
60
|
+
* Updated using latest gl.xml.
|
61
|
+
|
62
|
+
2016-01-03 vaiorabbit <http://twitter.com/vaiorabbit>
|
63
|
+
|
64
|
+
* LICENSE.txt: Updated copyright year.
|
65
|
+
|
1
66
|
2015-12-29 vaiorabbit <http://twitter.com/vaiorabbit>
|
2
67
|
|
3
68
|
* lib/glfw.rb, lib/glfw30.rb, lib/glut.rb: 'create_callback' now creates
|
data/LICENSE.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
Ruby-OpenGL : Yet another OpenGL wrapper for Ruby (and wrapper code generator)
|
2
|
-
Copyright (c) 2013-
|
2
|
+
Copyright (c) 2013-2016 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,17 +5,17 @@
|
|
5
5
|
...and wrapper code generator.
|
6
6
|
|
7
7
|
* Created : 2013-08-28
|
8
|
-
* Last modified :
|
8
|
+
* Last modified : 2016-06-03
|
9
9
|
|
10
10
|
|
11
11
|
## Features ##
|
12
12
|
|
13
13
|
* Uses Fiddle (One of the Ruby standard libraries that wraps libffi)
|
14
|
-
|
14
|
+
* Unlike opengl ( https://rubygems.org/gems/opengl ), you don't need to build C extension library
|
15
15
|
|
16
16
|
* Uses Khronos XML API registry
|
17
|
-
|
18
|
-
|
17
|
+
* The command/enum wrapper codes are generated via 'gl.xml'
|
18
|
+
* Supports OpenGL - 4.5, OpenGL ES - 3.1 and all OpenGL extensions.
|
19
19
|
|
20
20
|
|
21
21
|
## How to install ##
|
@@ -84,9 +84,9 @@ https://github.com/vaiorabbit/ruby-opengl
|
|
84
84
|
## Prerequisites ##
|
85
85
|
|
86
86
|
* Fiddle
|
87
|
-
|
88
|
-
|
89
|
-
|
87
|
+
* A libffi wrapper
|
88
|
+
* Standard library since Ruby 2.0.0
|
89
|
+
* I recommend you to use Ruby 2.1.2 and later, which fixed Fiddle's memory leak issue (https://bugs.ruby-lang.org/issues/9599).
|
90
90
|
|
91
91
|
### For sample ###
|
92
92
|
|
@@ -104,6 +104,8 @@ Use GLFW or GLUT for creating windows and OpenGL rendering contexts.
|
|
104
104
|
## Tested Environment ##
|
105
105
|
|
106
106
|
* Ruby
|
107
|
+
* ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
|
108
|
+
* ruby 2.3.0p0 (2015-12-25 revision 53290) [x64-mingw32]
|
107
109
|
* ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
|
108
110
|
* ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
|
109
111
|
* ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
|
@@ -116,6 +118,20 @@ Use GLFW or GLUT for creating windows and OpenGL rendering contexts.
|
|
116
118
|
* ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-darwin13.0.0]
|
117
119
|
* ruby 2.0.0p247 (2013-06-27) [i386-mingw32]
|
118
120
|
|
121
|
+
* Windows 10 Home, 64-bit (Version 1511, OS Build 10586.164)
|
122
|
+
* NVIDIA GeForce GTX 960
|
123
|
+
* OpenGL 4.5
|
124
|
+
|
125
|
+
> ruby report_env.rb
|
126
|
+
Version: 4.5.0 NVIDIA 364.72
|
127
|
+
|
128
|
+
* Windows 7 Home Premium, 64-bit (Service Pack 1)
|
129
|
+
* NVIDIA GeForce GTX 560
|
130
|
+
* OpenGL 4.3
|
131
|
+
|
132
|
+
> ruby report_env.rb
|
133
|
+
4.3.0
|
134
|
+
|
119
135
|
* Windows 7 Home Premium, 64-bit (Service Pack 1)
|
120
136
|
* NVIDIA GeForce GTX 560
|
121
137
|
* OpenGL 4.3
|
@@ -152,44 +168,56 @@ Use GLFW or GLUT for creating windows and OpenGL rendering contexts.
|
|
152
168
|
Version: 3.0 Mesa 10.6.3
|
153
169
|
|
154
170
|
* You can use any lib/path names by passing as arguments like:
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
171
|
+
* OpenGL.load_lib( 'libGL.so', '/usr/lib' )
|
172
|
+
* GLFW.load_lib( 'libglfw.so', '/usr/lib' )
|
173
|
+
* GLU.load_lib( 'libGLU.so', '/usr/lib' )
|
174
|
+
* GLUT.load_lib( 'libglut.so', '/usr/lib' )
|
159
175
|
|
160
176
|
## Note ##
|
161
177
|
|
162
178
|
* No Ruby-Style handy interfaces are available (like one in the ruby-opengl2 ( http://ruby-opengl.rubyforge.org/ ))
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
*
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
179
|
+
* Example:
|
180
|
+
* (Original C API)
|
181
|
+
|
182
|
+
GLuint tex_names_buf[2];
|
183
|
+
glGenTextures( 2, tex_names_buf );
|
184
|
+
GLuint tex_name = tex_names_buf[0];
|
185
|
+
|
186
|
+
* (This library)
|
187
|
+
|
188
|
+
tex_names_buf = ' ' * 8 # String instance that is enough to catch texture names (integer).
|
189
|
+
glGenTextures( 2, tex_names_buf )
|
190
|
+
tex_name = tex_names_buf.unpack('L2')[0]
|
191
|
+
|
192
|
+
* (ruby-opengl2)
|
193
|
+
|
194
|
+
tex_name = glGenTextures( 2 )[0]
|
195
|
+
|
196
|
+
* Projects using opengl-bindings
|
197
|
+
* ruby-gnome2
|
198
|
+
* https://github.com/ruby-gnome2/ruby-gnome2
|
199
|
+
* https://github.com/ruby-gnome2/ruby-gnome2/tree/master/gtk3/sample/misc
|
200
|
+
* gtkglarea1.rb, gtkglarea2.rb
|
201
|
+
* dxsdl2r
|
202
|
+
* https://github.com/mirichi/dxsdl2r
|
203
|
+
* mittsu - A direct port of THREE.js from JavaScript/WebGL to Ruby/OpenGL
|
204
|
+
* https://rubygems.org/gems/mittsu
|
205
|
+
* https://github.com/jellymann/mittsu
|
206
|
+
* opencl-bindings - A Ruby binding for OpenCL 1.2
|
207
|
+
* https://rubygems.org/gems/opencl-bindings
|
208
|
+
* https://github.com/vaiorabbit/ruby-opencl
|
209
|
+
|
210
|
+
* Other informative projects
|
211
|
+
* argon | neon
|
212
|
+
* https://github.com/npomf/argon
|
213
|
+
* https://bitbucket.org/npomf/neon/src
|
214
|
+
* "vaiorabbit / ruby-opengl - as the basis for the OpenGL, OpenAL, and GLFW FFI libraries."
|
187
215
|
|
188
216
|
## License ##
|
189
217
|
|
190
218
|
The zlib/libpng License ( http://opensource.org/licenses/Zlib ).
|
191
219
|
|
192
|
-
Copyright (c) 2013-
|
220
|
+
Copyright (c) 2013-2016 vaiorabbit <http://twitter.com/vaiorabbit>
|
193
221
|
|
194
222
|
This software is provided 'as-is', without any express or implied
|
195
223
|
warranty. In no event will the authors be held liable for any damages
|
@@ -292,9 +320,9 @@ https://github.com/vaiorabbit/ruby-opengl
|
|
292
320
|
## 必要なもの ##
|
293
321
|
|
294
322
|
* Fiddle
|
295
|
-
|
296
|
-
|
297
|
-
|
323
|
+
* libffi のラッパーです
|
324
|
+
* Ruby 2.0.0 以降で標準ライブラリになりました
|
325
|
+
* Fiddle のメモリリーク問題 (https://bugs.ruby-lang.org/issues/9599) が修正された Ruby 2.1.2 以降での利用を推奨します
|
298
326
|
|
299
327
|
### サンプル用 ###
|
300
328
|
|
@@ -312,6 +340,8 @@ GLFW か GLUT を用意してください。ウィンドウやレンダリング
|
|
312
340
|
## テストした環境 ##
|
313
341
|
|
314
342
|
* Ruby
|
343
|
+
* ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
|
344
|
+
* ruby 2.3.0p0 (2015-12-25 revision 53290) [x64-mingw32]
|
315
345
|
* ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
|
316
346
|
* ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
|
317
347
|
* ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
|
@@ -324,6 +354,13 @@ GLFW か GLUT を用意してください。ウィンドウやレンダリング
|
|
324
354
|
* ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-darwin13.0.0]
|
325
355
|
* ruby 2.0.0p247 (2013-06-27) [i386-mingw32]
|
326
356
|
|
357
|
+
* Windows 10 Home, 64-bit (Version 1511, OS Build 10586.164)
|
358
|
+
* NVIDIA GeForce GTX 960
|
359
|
+
* OpenGL 4.5
|
360
|
+
|
361
|
+
> ruby report_env.rb
|
362
|
+
Version: 4.5.0 NVIDIA 364.72
|
363
|
+
|
327
364
|
* Windows 7 Home Premium, 64-bit (Service Pack 1)
|
328
365
|
* NVIDIA GeForce GTX 560
|
329
366
|
* OpenGL 4.3
|
@@ -360,38 +397,51 @@ GLFW か GLUT を用意してください。ウィンドウやレンダリング
|
|
360
397
|
Version: 3.0 Mesa 10.6.3
|
361
398
|
|
362
399
|
* 引数として渡すことで任意のライブラリ名/パス名を利用できます:
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
400
|
+
* OpenGL.load_lib( 'libGL.so', '/usr/lib' )
|
401
|
+
* GLFW.load_lib( 'libglfw.so', '/usr/lib' )
|
402
|
+
* GLU.load_lib( 'libGLU.so', '/usr/lib' )
|
403
|
+
* GLUT.load_lib( 'libglut.so', '/usr/lib' )
|
367
404
|
|
368
405
|
|
369
406
|
## メモ ##
|
370
407
|
|
371
408
|
* Rubyスタイルの便利なインターフェースはサポートしていません (ruby-opengl2 ( http://ruby-opengl.rubyforge.org/ ) にあったような感じのもの)
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
*
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
409
|
+
* 例:
|
410
|
+
* (OpenGLオリジナルの C API)
|
411
|
+
|
412
|
+
GLuint tex_names_buf[2];
|
413
|
+
glGenTextures( 2, tex_names_buf );
|
414
|
+
GLuint tex_name = tex_names_buf[0];
|
415
|
+
|
416
|
+
* (このライブラリの場合)
|
417
|
+
|
418
|
+
tex_names_buf = ' ' * 8 # テクスチャ名(GLuint)を受け取るのに十分なサイズ String インスタンスであればOK
|
419
|
+
glGenTextures( 2, tex_names_buf )
|
420
|
+
tex_name = tex_names_buf.unpack('L2')[0]
|
421
|
+
|
422
|
+
* (ruby-opengl2 の場合)
|
423
|
+
|
424
|
+
tex_name = glGenTextures( 2 )[0] # glGenTextures が配列を返すように修正されています
|
425
|
+
|
426
|
+
* opengl-bindings を使ったプロジェクト
|
427
|
+
* ruby-gnome2
|
428
|
+
* https://github.com/ruby-gnome2/ruby-gnome2
|
429
|
+
* https://github.com/ruby-gnome2/ruby-gnome2/tree/master/gtk3/sample/misc
|
430
|
+
* gtkglarea1.rb, gtkglarea2.rb
|
431
|
+
* dxsdl2r
|
432
|
+
* https://github.com/mirichi/dxsdl2r
|
433
|
+
* mittsu - A direct port of THREE.js from JavaScript/WebGL to Ruby/OpenGL
|
434
|
+
* https://rubygems.org/gems/mittsu
|
435
|
+
* https://github.com/jellymann/mittsu
|
436
|
+
* opencl-bindings - A Ruby binding for OpenCL 1.2
|
437
|
+
* https://rubygems.org/gems/opencl-bindings
|
438
|
+
* https://github.com/vaiorabbit/ruby-opencl
|
439
|
+
|
440
|
+
* 参考になりそうなプロジェクト
|
441
|
+
* argon | neon
|
442
|
+
* https://github.com/npomf/argon
|
443
|
+
* https://bitbucket.org/npomf/neon/src
|
444
|
+
* "vaiorabbit / ruby-opengl - as the basis for the OpenGL, OpenAL, and GLFW FFI libraries."
|
395
445
|
|
396
446
|
|
397
447
|
## ライセンス ##
|
data/lib/glfw.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
# A GLFW wrapper (for version 3.1)
|
2
|
+
# A GLFW wrapper (for version 3.0, 3.1 and 3.2)
|
3
3
|
require 'fiddle/import'
|
4
4
|
|
5
5
|
module GLFW
|
@@ -35,9 +35,8 @@ module GLFW
|
|
35
35
|
end
|
36
36
|
|
37
37
|
# defines
|
38
|
-
|
39
|
-
|
40
|
-
GLFW_VERSION_REVISION = 0
|
38
|
+
GLFW_TRUE = 1 # Available since GLFW 3.2
|
39
|
+
GLFW_FALSE = 0 # Available since GLFW 3.2
|
41
40
|
|
42
41
|
GLFW_RELEASE = 0
|
43
42
|
GLFW_PRESS = 1
|
@@ -213,14 +212,16 @@ module GLFW
|
|
213
212
|
GLFW_VERSION_UNAVAILABLE = 0x00010007
|
214
213
|
GLFW_PLATFORM_ERROR = 0x00010008
|
215
214
|
GLFW_FORMAT_UNAVAILABLE = 0x00010009
|
215
|
+
GLFW_NO_WINDOW_CONTEXT = 0x0001000A # Available since GLFW 3.2
|
216
216
|
|
217
217
|
GLFW_FOCUSED = 0x00020001
|
218
218
|
GLFW_ICONIFIED = 0x00020002
|
219
219
|
GLFW_RESIZABLE = 0x00020003
|
220
220
|
GLFW_VISIBLE = 0x00020004
|
221
221
|
GLFW_DECORATED = 0x00020005
|
222
|
-
GLFW_AUTO_ICONIFY = 0x00020006
|
223
|
-
GLFW_FLOATING = 0x00020007
|
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
|
224
225
|
|
225
226
|
GLFW_RED_BITS = 0x00021001
|
226
227
|
GLFW_GREEN_BITS = 0x00021002
|
@@ -248,7 +249,10 @@ module GLFW
|
|
248
249
|
GLFW_OPENGL_DEBUG_CONTEXT = 0x00022007
|
249
250
|
GLFW_OPENGL_PROFILE = 0x00022008
|
250
251
|
GLFW_CONTEXT_RELEASE_BEHAVIOR = 0x00022009
|
252
|
+
GLFW_CONTEXT_NO_ERROR = 0x0002200A
|
253
|
+
GLFW_CONTEXT_CREATION_API = 0x0002200B # Available since GLFW 3.2
|
251
254
|
|
255
|
+
GLFW_NO_API = 0 # Available since GLFW 3.2
|
252
256
|
GLFW_OPENGL_API = 0x00030001
|
253
257
|
GLFW_OPENGL_ES_API = 0x00030002
|
254
258
|
|
@@ -272,6 +276,9 @@ module GLFW
|
|
272
276
|
GLFW_RELEASE_BEHAVIOR_FLUSH = 0x00035001
|
273
277
|
GLFW_RELEASE_BEHAVIOR_NONE = 0x00035002
|
274
278
|
|
279
|
+
GLFW_NATIVE_CONTEXT_API = 0x00036001 # Available since GLFW 3.2
|
280
|
+
GLFW_EGL_CONTEXT_API = 0x00036002 # Available since GLFW 3.2
|
281
|
+
|
275
282
|
GLFW_ARROW_CURSOR = 0x00036001
|
276
283
|
GLFW_IBEAM_CURSOR = 0x00036002
|
277
284
|
GLFW_CROSSHAIR_CURSOR = 0x00036003
|
@@ -300,9 +307,10 @@ module GLFW
|
|
300
307
|
:GLFWscrollfun => "void GLFWscrollfun(void*,double,double)",
|
301
308
|
:GLFWkeyfun => "void GLFWkeyfun(void*,int,int,int,int)",
|
302
309
|
:GLFWcharfun => "void GLFWcharfun(void*,unsigned int)",
|
303
|
-
:GLFWcharmodsfun => "void GLFWcharmodsfun(void*,unsigned int,int)",
|
304
|
-
:GLFWdropfun => "void GLFWdropfun(void*,int,const char**)",
|
305
|
-
:GLFWmonitorfun => "void GLFWmonitorfun(void*,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
|
306
314
|
}
|
307
315
|
|
308
316
|
# Creates a callback as an instance of Fiddle::Function
|
@@ -342,12 +350,14 @@ module GLFW
|
|
342
350
|
GLFWkeyfun_cb_retval = Fiddle::TYPE_VOID
|
343
351
|
GLFWcharfun_cb_args = [Fiddle::TYPE_VOIDP, -Fiddle::TYPE_INT]
|
344
352
|
GLFWcharfun_cb_retval = Fiddle::TYPE_VOID
|
345
|
-
GLFWcharmodsfun_cb_args = [Fiddle::TYPE_VOIDP, -Fiddle::TYPE_INT, Fiddle::TYPE_INT]
|
346
|
-
GLFWcharmodsfun_cb_retval = Fiddle::TYPE_VOID
|
347
|
-
GLFWdropfun_cb_args = [Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT, Fiddle::TYPE_VOIDP]
|
348
|
-
GLFWdropfun_cb_retval = Fiddle::TYPE_VOID
|
349
|
-
GLFWmonitorfun_cb_args = [Fiddle::TYPE_VOIDP, Fiddle::TYPE_INT]
|
350
|
-
GLFWmonitorfun_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
|
351
361
|
|
352
362
|
@@glfw_cb_closure_signature = {
|
353
363
|
:GLFWerrorfun => [GLFWerrorfun_cb_retval, GLFWerrorfun_cb_args],
|
@@ -364,9 +374,10 @@ module GLFW
|
|
364
374
|
:GLFWscrollfun => [GLFWscrollfun_cb_retval, GLFWscrollfun_cb_args],
|
365
375
|
:GLFWkeyfun => [GLFWkeyfun_cb_retval, GLFWkeyfun_cb_args],
|
366
376
|
:GLFWcharfun => [GLFWcharfun_cb_retval, GLFWcharfun_cb_args],
|
367
|
-
:GLFWcharmodsfun => [GLFWcharmodsfun_cb_retval, GLFWcharmodsfun_cb_args],
|
368
|
-
:GLFWdropfun => [GLFWdropfun_cb_retval, GLFWdropfun_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
|
369
379
|
:GLFWmonitorfun => [GLFWmonitorfun_cb_retval, GLFWmonitorfun_cb_args],
|
380
|
+
:GLFWjoystickfun => [GLFWjoystickfun_cb_retval, GLFWjoystickfun_cb_args], # Available since GLFW 3.2
|
370
381
|
}
|
371
382
|
|
372
383
|
# Creates a callback as an instance of Fiddle::Closure::BlockCaller
|
@@ -398,6 +409,7 @@ module GLFW
|
|
398
409
|
"unsigned short* blue",
|
399
410
|
"unsigned int size"])
|
400
411
|
|
412
|
+
# Available since GLFW 3.1
|
401
413
|
GLFWimage = struct(["int width",
|
402
414
|
"int height",
|
403
415
|
"unsigned char* pixels"])
|
@@ -405,7 +417,7 @@ module GLFW
|
|
405
417
|
@@glfw_import_done = false
|
406
418
|
|
407
419
|
# Load native library.
|
408
|
-
def self.load_lib(lib = nil, path = nil)
|
420
|
+
def self.load_lib(lib = nil, path = nil, output_error = false)
|
409
421
|
if lib == nil && path == nil
|
410
422
|
case OpenGL.get_platform
|
411
423
|
when :OPENGL_PLATFORM_WINDOWS
|
@@ -422,7 +434,7 @@ module GLFW
|
|
422
434
|
else
|
423
435
|
dlload (lib)
|
424
436
|
end
|
425
|
-
import_symbols() unless @@glfw_import_done
|
437
|
+
import_symbols(output_error) unless @@glfw_import_done
|
426
438
|
end
|
427
439
|
|
428
440
|
def self.load_dll(lib = nil, path = nil)
|
@@ -430,89 +442,153 @@ module GLFW
|
|
430
442
|
self.load_lib(lib, path)
|
431
443
|
end
|
432
444
|
|
433
|
-
|
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
|
+
|
434
548
|
# function
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
extern 'void glfwDefaultWindowHints()'
|
452
|
-
extern 'void glfwWindowHint(int, int)'
|
453
|
-
extern 'void* glfwCreateWindow(int, int, const char*, void*, void*)'
|
454
|
-
extern 'void glfwDestroyWindow(void*)'
|
455
|
-
extern 'int glfwWindowShouldClose(void*)'
|
456
|
-
extern 'void glfwSetWindowShouldClose(void* window, int)'
|
457
|
-
extern 'void glfwSetWindowTitle(void*, const char*)'
|
458
|
-
extern 'void glfwGetWindowPos(void*, int*, int*)'
|
459
|
-
extern 'void glfwSetWindowPos(void*, int, int)'
|
460
|
-
extern 'void glfwGetWindowSize(void*, int*, int*)'
|
461
|
-
extern 'void glfwSetWindowSize(void*, int, int)'
|
462
|
-
extern 'void glfwGetFramebufferSize(void*, int*, int*)'
|
463
|
-
extern 'void glfwGetWindowFrameSize(void*, int*, int*, int*, int*)'
|
464
|
-
extern 'void glfwIconifyWindow(void*)'
|
465
|
-
extern 'void glfwRestoreWindow(void*)'
|
466
|
-
extern 'void glfwShowWindow(void*)'
|
467
|
-
extern 'void glfwHideWindow(void*)'
|
468
|
-
extern 'void* glfwGetWindowMonitor(void*)'
|
469
|
-
extern 'int glfwGetWindowAttrib(void*, int)'
|
470
|
-
extern 'void glfwSetWindowUserPointer(void*, void*)'
|
471
|
-
extern 'void* glfwGetWindowUserPointer(void*)'
|
472
|
-
extern 'void* glfwSetWindowPosCallback(void*, void*)'
|
473
|
-
extern 'void* glfwSetWindowSizeCallback(void*, void*)'
|
474
|
-
extern 'void* glfwSetWindowCloseCallback(void*, void*)'
|
475
|
-
extern 'void* glfwSetWindowRefreshCallback(void*, void*)'
|
476
|
-
extern 'void* glfwSetWindowFocusCallback(void*, void*)'
|
477
|
-
extern 'void* glfwSetWindowIconifyCallback(void*, void*)'
|
478
|
-
extern 'void* glfwSetFramebufferSizeCallback(void*, void*)'
|
479
|
-
extern 'void glfwPollEvents()'
|
480
|
-
extern 'void glfwWaitEvents()'
|
481
|
-
extern 'void glfwPostEmptyEvent()'
|
482
|
-
extern 'int glfwGetInputMode(void*, int)'
|
483
|
-
extern 'void glfwSetInputMode(void*, int, int)'
|
484
|
-
extern 'int glfwGetKey(void*, int)'
|
485
|
-
extern 'int glfwGetMouseButton(void*, int)'
|
486
|
-
extern 'void glfwGetCursorPos(void*, double*, double*)'
|
487
|
-
extern 'void glfwSetCursorPos(void*, double, double)'
|
488
|
-
extern 'void* glfwCreateCursor(void*, int, int)'
|
489
|
-
extern 'void* glfwCreateStandardCursor(int)'
|
490
|
-
extern 'void glfwDestroyCursor(void*)'
|
491
|
-
extern 'void glfwSetCursor(void*, void*)'
|
492
|
-
extern 'void* glfwSetKeyCallback(void*, void*)'
|
493
|
-
extern 'void* glfwSetCharCallback(void*, void*)'
|
494
|
-
extern 'void* glfwSetCharModsCallback(void*, void*)'
|
495
|
-
extern 'void* glfwSetMouseButtonCallback(void*, void*)'
|
496
|
-
extern 'void* glfwSetCursorPosCallback(void*, void*)'
|
497
|
-
extern 'void* glfwSetCursorEnterCallback(void*, void*)'
|
498
|
-
extern 'void* glfwSetScrollCallback(void*, void*)'
|
499
|
-
extern 'void* glfwSetDropCallback(void*, void*)'
|
500
|
-
extern 'int glfwJoystickPresent(int)'
|
501
|
-
extern 'const float* glfwGetJoystickAxes(int, int*)'
|
502
|
-
extern 'const unsigned char* glfwGetJoystickButtons(int, int*)'
|
503
|
-
extern 'const char* glfwGetJoystickName(int)'
|
504
|
-
extern 'void glfwSetClipboardString(void*, const char*)'
|
505
|
-
extern 'const char* glfwGetClipboardString(void*)'
|
506
|
-
extern 'double glfwGetTime()'
|
507
|
-
extern 'void glfwSetTime(double)'
|
508
|
-
extern 'void glfwMakeContextCurrent(void*)'
|
509
|
-
extern 'void* glfwGetCurrentContext()'
|
510
|
-
extern 'void glfwSwapBuffers(void*)'
|
511
|
-
extern 'void glfwSwapInterval(int)'
|
512
|
-
extern 'int glfwExtensionSupported(const char*)'
|
513
|
-
extern 'void* glfwGetProcAddress(const char*)'
|
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])
|
514
565
|
|
515
566
|
@@glfw_import_done = true
|
516
567
|
end
|
517
568
|
|
518
569
|
end
|
570
|
+
|
571
|
+
=begin
|
572
|
+
Ruby-OpenGL : Yet another OpenGL wrapper for Ruby (and wrapper code generator)
|
573
|
+
Copyright (c) 2013-2016 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
|
+
|