opengl-bindings2 2.0.0.rc1 → 2.0.0rc2

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.
data/README.md CHANGED
@@ -1,564 +1,564 @@
1
- <!-- -*- mode:markdown; coding:utf-8; -*- -->
2
-
3
- # Yet another OpenGL wrapper for Ruby #
4
-
5
- ...and wrapper code generator.
6
-
7
- * Created : 2013-08-28
8
- * Last modified : 2022-01-06
9
-
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
-
12
- <img src="https://raw.githubusercontent.com/vaiorabbit/ruby-opengl/master/doc/simple_rb.jpg" width="200"> <img src="https://raw.githubusercontent.com/vaiorabbit/ruby-opengl/master/doc/nehe_lesson36_rb.jpg" width="200"> <img src="https://raw.githubusercontent.com/vaiorabbit/ruby-opengl/master/doc/brick_rb.jpg" width="200"> <img src="https://raw.githubusercontent.com/vaiorabbit/ruby-opengl/master/doc/glxs_rb.jpg" width="200">
13
-
14
-
15
- ## Features ##
16
-
17
- * Uses Fiddle (One of the Ruby standard libraries that wraps libffi)
18
- * Unlike opengl ( https://rubygems.org/gems/opengl ), you don't need to build C extension library
19
-
20
- * Uses Khronos XML API registry ( https://github.com/KhronosGroup/OpenGL-Registry )
21
- * The command/enum wrapper codes are generated via 'gl.xml'
22
- * Supports OpenGL - 4.6, OpenGL ES - 3.1 and all OpenGL extensions.
23
-
24
-
25
- ## How to install ##
26
-
27
- Via RubyGems ( https://rubygems.org/gems/opengl-bindings ):
28
-
29
- $ gem install opengl-bindings
30
-
31
- Or grab all library codes (`lib/*.rb') and use them by adding as one of the load paths like:
32
-
33
- $ ruby -I ./lib your_app.rb
34
-
35
-
36
- ## How to use ##
37
-
38
- See sample/simple.rb or sample/simple_glut.rb.
39
-
40
- To get more samples and generator scripts, please visit:
41
- https://github.com/vaiorabbit/ruby-opengl
42
-
43
-
44
- ## Contents ##
45
-
46
- * 'opengl.rb' includes these scripts:
47
- * 'opengl_command.rb' : OpenGL command wrapper (glDrawRangeElements, etc.). Generated via generator/generate_command.rb.
48
- * 'opengl_enum.rb' : OpenGL enum wrapper (GL_TRIANGLE_STRIP, etc.). Generated via generator/generate_enum.rb.
49
- * 'opengl_common.rb' : Provides utility functions.
50
- * 'opengl_platform.rb' : Provides platform check functions (OpneGL.get_platform).
51
- * 'opengl_windows.rb' : Provides functions for Windows platform (wglGetProcAddress, wglGetCurrentContext, wglGetCurrentDC).
52
- * 'opengl_macosx.rb' : Provides functions for Mac OS X platform (CGLGetCurrentContext, CGLGetShareGroup).
53
- * 'opengl_linux.rb' : Provides functions for Linux (X Window) platform (glXGetCurrentContext, glXGetCurrentDisplay).
54
-
55
- * 'opengl_es.rb' is almost the same with 'opengl.rb', except for including 'opengl_es_command.rb' and 'opengl_es_enum.rb'.
56
-
57
- * 'opengl_ext.rb' includes these scripts:
58
- * 'opengl_ext_command.rb' : OpenGL extension command wrapper. Generated via generator/generate_ext_command.rb.
59
- * 'opengl_ext_enum.rb' : OpenGL extension enum wrapper Generated via generator/generate_ext_enum.rb.
60
- * 'opengl_ext_common.rb' : Provides utility functions.
61
-
62
- * 'opengl_es_ext.rb' is almost the same with 'opengl_ext.rb', except for including 'opengl_es_ext_command.rb' and 'opengl_es_ext_enum.rb'.
63
-
64
- * 'glfw.rb'
65
- * My handwritten GLFW wrapper.
66
-
67
- * 'glut.rb'
68
- * GLUT wrapper. Supports API Level 4 (GLUT_API_VERSION = 4).
69
-
70
- * 'glu.rb'
71
- * My handwritten GLU wrapper.
72
-
73
- * 'generator/gl.xml'
74
- * Khronos' official XML API registry for OpenGL.
75
-
76
- * 'generator/Rakefile'
77
- * Type 'rake' to generate wrapper codes / fetch gl.xml.
78
- * You can get the latest one by 'get_gl_xml.rb'.
79
-
80
- * 'sample/simple.rb', 'sample/simple_glut.rb'
81
- * Simple example.
82
- * simple.rb : You need to get glfw3.dll (Windows) or libglfw.dylib (Mac OS X). See sample/README.md.
83
- * simple_glut.rb : (For Windows uses) You need to get freeglut.dll. See sample/README.md.
84
-
85
- * 'sample/data', 'sample/util'
86
- * Data and utilities for sample programs.
87
-
88
- ## Prerequisites ##
89
-
90
- * Fiddle
91
- * A libffi wrapper
92
- * Standard library since Ruby 2.0.0
93
- * 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).
94
-
95
- ### For sample ###
96
-
97
- Use GLFW or GLUT for creating windows and OpenGL rendering contexts.
98
-
99
- * GLFW
100
- * http://www.glfw.org/
101
- * http://www.glfw.org/download.html
102
-
103
- * freeglut
104
- * http://freeglut.sourceforge.net
105
- * http://freeglut.sourceforge.net/index.php#download
106
-
107
-
108
- ## Tested Environment ##
109
-
110
- * Ruby
111
- * ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [arm64-darwin20]
112
- * ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x64-mingw32]
113
- * ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [arm64-darwin20]
114
- * ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [arm64-darwin20]
115
- * ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x64-mingw32]
116
- * ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [arm64-darwin20]
117
- * ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [arm64-darwin20]
118
- * ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x64-mingw32]
119
- * ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19]
120
- * ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]
121
- * ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-darwin18]
122
- * ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-darwin18]
123
- * ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
124
- * ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin17]
125
- * ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
126
- * ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16]
127
- * ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
128
- * ruby 2.3.0p0 (2015-12-25 revision 53290) [x64-mingw32]
129
- * ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
130
- * ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
131
- * ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
132
- * ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
133
- * ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
134
- * ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
135
- * ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
136
- * ruby 2.1.2p95 (2014-05-08 revision 45877) [i386-mingw32]
137
- * ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin12.0]
138
- * ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-darwin13.0.0]
139
- * ruby 2.0.0p247 (2013-06-27) [i386-mingw32]
140
-
141
- * Windows 10 Home, 64-bit (Version 1909, OS Build 18363.778)
142
- * NVIDIA GeForce RTX 2060 SUPER
143
- * OpenGL 4.5
144
-
145
- > ruby report_env.rb
146
- Version : 4.5.0 NVIDIA 436.30
147
- Vendor : NVIDIA Corporation
148
- Renderer : GeForce RTX 2060 SUPER/PCIe/SSE2
149
- Shader : 4.50 NVIDIA
150
-
151
- * Windows 10 Home, 64-bit (Version 1511, OS Build 10586.164)
152
- * NVIDIA GeForce GTX 960
153
- * OpenGL 4.5
154
-
155
- > ruby report_env.rb
156
- Version: 4.5.0 NVIDIA 364.72
157
-
158
- * Windows 7 Home Premium, 64-bit (Service Pack 1)
159
- * NVIDIA GeForce GTX 560
160
- * OpenGL 4.3
161
-
162
- > ruby report_env.rb
163
- 4.3.0
164
-
165
- * Windows 7 Home Premium, 64-bit (Service Pack 1)
166
- * NVIDIA GeForce GTX 560
167
- * OpenGL 4.3
168
-
169
- > ruby report_env.rb
170
- 4.3.0
171
-
172
- * Mac OS X 10.8.4, 64-bit
173
- * NVIDIA GeForce 320M on Mac mini (Mid 2010)
174
- * OpenGL 2.1
175
-
176
- $ ruby report_env.rb
177
- 2.1 NVIDIA-8.12.47 310.40.00.05f01
178
-
179
- * Mac OS X 10.10.5, 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-10.6.33
185
-
186
- * Mac OS X 10.15.3, 64-bit
187
- * Intel Iris on Mac mini (Late 2014)
188
- * OpenGL 4.1
189
-
190
- $ ruby report_env.rb
191
- Version : 4.1 INTEL-14.4.23
192
- Vendor : Intel Inc.
193
- Renderer : Intel Iris OpenGL Engine
194
- Shader : 4.10
195
-
196
- * macOS 12.1, 64-bit
197
- * Mac mini (M1 2020)
198
- * OpenGL 4.1
199
-
200
- $ ruby report_env.rb
201
- Version : 4.1 Metal - 76.3
202
- Vendor : Apple
203
- Renderer : Apple M1
204
- Shader : 4.10
205
-
206
- * Arch Linux kernel 4.1.2-2-ARCH, Nvidia Driver, x86_64
207
- * NVIDIA GeForce GTS 450
208
- * OpenGL 4.5.0
209
-
210
- $ ruby report_env.rb
211
- Version: 4.5.0 NVIDIA 352.21
212
-
213
- * Arch Linux kernel 4.1.4-1-ARCH, Nouveau Driver, x86_64
214
- * NVIDIA GeForce GTS 450
215
- * OpenGL 3.0
216
-
217
- $ ruby report_env.rb
218
- Version: 3.0 Mesa 10.6.3
219
-
220
- * You can use any lib/path names by passing as arguments like:
221
- * OpenGL.load_lib( 'libGL.so', '/usr/lib' )
222
- * GLFW.load_lib( 'libglfw.so', '/usr/lib' )
223
- * GLU.load_lib( 'libGLU.so', '/usr/lib' )
224
- * GLUT.load_lib( 'libglut.so', '/usr/lib' )
225
-
226
- ## Note ##
227
-
228
- * No Ruby-Style handy interfaces are available (like one in the ruby-opengl2 ( http://ruby-opengl.rubyforge.org/ ))
229
- * Example:
230
- * (Original C API)
231
-
232
- GLuint tex_names_buf[2];
233
- glGenTextures( 2, tex_names_buf );
234
- GLuint tex_name = tex_names_buf[0];
235
-
236
- * (This library)
237
-
238
- tex_names_buf = ' ' * 8 # String instance that is enough to catch texture names (integer).
239
- glGenTextures( 2, tex_names_buf )
240
- tex_name = tex_names_buf.unpack('L2')[0]
241
-
242
- * (ruby-opengl2)
243
-
244
- tex_name = glGenTextures( 2 )[0]
245
-
246
- * Projects using opengl-bindings
247
- * ruby-gnome2
248
- * https://github.com/ruby-gnome2/ruby-gnome2
249
- * https://github.com/ruby-gnome2/ruby-gnome2/tree/master/gtk3/sample/misc
250
- * gtkglarea1.rb, gtkglarea2.rb
251
- * FXRuby - A library for cross-platform graphical user interfaces
252
- * https://github.com/larskanis/fxruby/blob/1.6/examples/glviewer.rb
253
- * dxsdl2r
254
- * https://github.com/mirichi/dxsdl2r
255
- * mittsu - A direct port of THREE.js from JavaScript/WebGL to Ruby/OpenGL
256
- * https://rubygems.org/gems/mittsu
257
- * https://github.com/jellymann/mittsu
258
- * opencl-bindings - A Ruby binding for OpenCL 1.2
259
- * https://rubygems.org/gems/opencl-bindings
260
- * https://github.com/vaiorabbit/ruby-opencl
261
- * perfume_dance - A BVH motion parser and playback implementation written in Ruby
262
- * https://github.com/vaiorabbit/perfume_dance
263
- * open.gl.rb - A port of the https://open.gl/ tutorials to Ruby
264
- * https://github.com/mechazoidal/opendotgl_rb
265
-
266
- * Other informative projects
267
- * argon | neon
268
- * https://github.com/npomf/argon
269
- * https://bitbucket.org/npomf/neon/src
270
- * "vaiorabbit / ruby-opengl - as the basis for the OpenGL, OpenAL, and GLFW FFI libraries."
271
-
272
- ## License ##
273
-
274
- The zlib/libpng License ( http://opensource.org/licenses/Zlib ).
275
-
276
- Copyright (c) 2013-2020 vaiorabbit <http://twitter.com/vaiorabbit>
277
-
278
- This software is provided 'as-is', without any express or implied
279
- warranty. In no event will the authors be held liable for any damages
280
- arising from the use of this software.
281
-
282
- Permission is granted to anyone to use this software for any purpose,
283
- including commercial applications, and to alter it and redistribute it
284
- freely, subject to the following restrictions:
285
-
286
- 1. The origin of this software must not be misrepresented; you must not
287
- claim that you wrote the original software. If you use this software in a
288
- product, an acknowledgment in the product documentation would be
289
- appreciated but is not required.
290
-
291
- 2. Altered source versions must be plainly marked as such, and must not be
292
- misrepresented as being the original software.
293
-
294
- 3. This notice may not be removed or altered from any source distribution.
295
-
296
- Sample codes/resources under sample/GLExcess are provided under the GNU General
297
- Public License version 2. See sample/GLExcess/GPL2.txt .
298
-
299
- Sample codes under sample/OrangeBook are provided under the BSD 3-Clause License.
300
- See sample/OrangeBook/3Dlabs-License.txt .
301
-
302
- -------------------------------------------------------------------------------
303
-
304
- # Ruby 用 OpenGL ラッパー (とその自動生成スクリプト) #
305
-
306
- ## 特徴 ##
307
-
308
- * 標準ライブラリ Fiddle を使っています ⇒ opengl ( https://rubygems.org/gems/opengl ) のように拡張ライブラリをビルドする必要がありません
309
- * 関数とenumのラッパーコードは Khronos の XML API registry ( https://github.com/KhronosGroup/OpenGL-Registry ) の gl.xml から自動生成しています
310
-
311
-
312
- ## インストール ##
313
-
314
- RubyGems経由で ( https://rubygems.org/gems/opengl-bindings ):
315
-
316
- $ gem install opengl-bindings
317
-
318
- もしくは lib 以下の *.rb をコピー → その場所をロードパスに加えて次のように起動:
319
-
320
- $ ruby -I ./lib your_app.rb
321
-
322
-
323
- ## 使い方 ##
324
-
325
- sample/simple.rb または sample/simple_glut.rb を参照してください。
326
-
327
- その他のサンプルと自動生成スクリプトはこちらで開発しています:
328
- https://github.com/vaiorabbit/ruby-opengl
329
-
330
-
331
- ## 内容 ##
332
-
333
- * 'opengl.rb' を require することで下記のスクリプトを取り込みます:
334
- * 'opengl_command.rb' : OpenGL 関数のラッパーコード (glDrawRangeElements, etc.)。 generator/generate_command.rb で自動生成されたものです。
335
- * 'opengl_enum.rb' : OpenGL enum のラッパーコード (GL_TRIANGLE_STRIP, etc.)。 generator/generate_enum.rb で自動生成されたものです。
336
- * 'opengl_common.rb' : 共通のユーティリティ関数を提供しています。
337
- * 'opengl_platform.rb' : 動作プラットフォームの判別機能を提供しています (OpneGL.get_platform)。
338
- * 'opengl_windows.rb' : Windows 用の機能を提供しています (wglGetProcAddress, wglGetCurrentContext, wglGetCurrentDC).
339
- * 'opengl_macosx.rb' : Mac OS X 用の機能を提供しています (CGLGetCurrentContext, CGLGetShareGroup).
340
- * 'opengl_linux.rb' : Linux (X Window) 用の機能を提供しています (glXGetCurrentContext, glXGetCurrentDisplay).
341
-
342
- * 'opengl_es.rb' は 'opengl_es_command.rb' と 'opengl_es_enum.rb' を取り込む以外は 'opengl.rb' と同じです。
343
-
344
- * 'opengl_ext.rb' を require することで下記のスクリプトを取り込みます:
345
- * 'opengl_ext_command.rb' : OpenGL 拡張関数のラッパーコード。 generator/generate_ext_command.rb で自動生成されたものです。
346
- * 'opengl_ext_enum.rb' : OpenGL 拡張enumのラッパーコード。 generator/generate_ext_enum.rb で自動生成されたものです。
347
-
348
- * 'opengl_es_ext.rb' は 'opengl_es_ext_command.rb' と 'opengl_es_ext_enum.rb' を取り込む以外は 'opengl_ext.rb' と同じです。
349
-
350
- * 'glfw.rb'
351
- * GLFW のラッパーコードです(自動生成ではありません)。
352
-
353
- * 'glut.rb'
354
- * GLUT ラッパー。API Level 4 までサポートしています (GLUT_API_VERSION = 4)。
355
-
356
-
357
- * 'glu.rb'
358
- * GLU のラッパーコードです(自動生成ではありません)。
359
-
360
- * 'generator/gl.xml'
361
- * Khronos 公式の XML API registry です。
362
-
363
- * 'generator/Rakefile'
364
- * 自動生成関連のタスクを自動化するためのものです。'rake' と打てば gl.xml の取得とラッパーコードの生成を実行します。
365
- * gl.xml の取得だけなど、単体のタスクなら 'get_gl_xml.rb' などの個別Rubyスクリプトでも実行できます。
366
-
367
- * 'sample/simple.rb', 'sample/simple_glut.rb'
368
- * 一番簡単なサンプルです。
369
- * simple.rb : 同じ場所に glfw3.dll (Windows) もしくは libglfw.dylib (Mac OS X) を置いてください。詳細は sample/README.md に記載されています。
370
- * simple_glut.rb : (Windows の場合) freeglut.dll を置いてください。詳細は sample/README.md に記載されています。
371
-
372
- * 'sample/data', 'sample/util'
373
- * サンプルで共有する機能・データの配置場所です。
374
-
375
-
376
- ## 必要なもの ##
377
-
378
- * Fiddle
379
- * libffi のラッパーです
380
- * Ruby 2.0.0 以降で標準ライブラリになりました
381
- * Fiddle のメモリリーク問題 (https://bugs.ruby-lang.org/issues/9599) が修正された Ruby 2.1.2 以降での利用を推奨します
382
-
383
- ### サンプル用 ###
384
-
385
- GLFW か GLUT を用意してください。ウィンドウやレンダリングコンテキストの管理に必要です。
386
-
387
- * GLFW
388
- * http://www.glfw.org/
389
- * http://www.glfw.org/download.html
390
-
391
- * freeglut
392
- * http://freeglut.sourceforge.net
393
- * http://freeglut.sourceforge.net/index.php#download
394
-
395
-
396
- ## テストした環境 ##
397
-
398
- * Ruby
399
- * ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [arm64-darwin20]
400
- * ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x64-mingw32]
401
- * ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [arm64-darwin20]
402
- * ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [arm64-darwin20]
403
- * ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x64-mingw32]
404
- * ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [arm64-darwin20]
405
- * ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [arm64-darwin20]
406
- * ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x64-mingw32]
407
- * ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19]
408
- * ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]
409
- * ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-darwin18]
410
- * ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-darwin18]
411
- * ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
412
- * ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin17]
413
- * ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
414
- * ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16]
415
- * ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
416
- * ruby 2.3.0p0 (2015-12-25 revision 53290) [x64-mingw32]
417
- * ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
418
- * ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
419
- * ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
420
- * ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
421
- * ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
422
- * ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
423
- * ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
424
- * ruby 2.1.2p95 (2014-05-08 revision 45877) [i386-mingw32]
425
- * ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin12.0]
426
- * ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-darwin13.0.0]
427
- * ruby 2.0.0p247 (2013-06-27) [i386-mingw32]
428
-
429
- * Windows 10 Home, 64-bit (Version 1909, OS Build 18363.778)
430
- * NVIDIA GeForce RTX 2060 SUPER
431
- * OpenGL 4.5
432
-
433
- > ruby report_env.rb
434
- Version : 4.5.0 NVIDIA 436.30
435
- Vendor : NVIDIA Corporation
436
- Renderer : GeForce RTX 2060 SUPER/PCIe/SSE2
437
- Shader : 4.50 NVIDIA
438
-
439
- * Windows 10 Home, 64-bit (Version 1511, OS Build 10586.164)
440
- * NVIDIA GeForce GTX 960
441
- * OpenGL 4.5
442
-
443
- > ruby report_env.rb
444
- Version: 4.5.0 NVIDIA 364.72
445
-
446
- * Windows 7 Home Premium, 64-bit (Service Pack 1)
447
- * NVIDIA GeForce GTX 560
448
- * OpenGL 4.3
449
-
450
- > ruby report_env.rb
451
- 4.3.0
452
-
453
- * Mac OS X 10.8.4, 64-bit
454
- * NVIDIA GeForce 320M on Mac mini (Mid 2010)
455
- * OpenGL 2.1
456
-
457
- $ ruby report_env.rb
458
- 2.1 NVIDIA-8.12.47 310.40.00.05f01
459
-
460
- * Mac OS X 10.10.5, 64-bit
461
- * Intel Iris on Mac mini (Late 2014)
462
- * OpenGL 4.1
463
-
464
- $ ruby report_env.rb
465
- Version: 4.1 INTEL-10.6.33
466
-
467
- * Mac OS X 10.15.3, 64-bit
468
- * Intel Iris on Mac mini (Late 2014)
469
- * OpenGL 4.1
470
-
471
- $ ruby report_env.rb
472
- Version : 4.1 INTEL-14.4.23
473
- Vendor : Intel Inc.
474
- Renderer : Intel Iris OpenGL Engine
475
- Shader : 4.10
476
-
477
- * macOS 12.1, 64-bit
478
- * Mac mini (M1 2020)
479
- * OpenGL 4.1
480
-
481
- $ ruby report_env.rb
482
- Version : 4.1 Metal - 76.3
483
- Vendor : Apple
484
- Renderer : Apple M1
485
- Shader : 4.10
486
-
487
- * Arch Linux kernel 4.1.2-2-ARCH, Nvidia Driver, x86_64
488
- * NVIDIA GeForce GTS 450
489
- * OpenGL 4.5.0
490
-
491
- $ ruby report_env.rb
492
- Version: 4.5.0 NVIDIA 352.21
493
-
494
- * Arch Linux kernel 4.1.4-1-ARCH, Nouveau Driver, x86_64
495
- * NVIDIA GeForce GTS 450
496
- * OpenGL 3.0
497
-
498
- $ ruby report_env.rb
499
- Version: 3.0 Mesa 10.6.3
500
-
501
- * 引数として渡すことで任意のライブラリ名/パス名を利用できます:
502
- * OpenGL.load_lib( 'libGL.so', '/usr/lib' )
503
- * GLFW.load_lib( 'libglfw.so', '/usr/lib' )
504
- * GLU.load_lib( 'libGLU.so', '/usr/lib' )
505
- * GLUT.load_lib( 'libglut.so', '/usr/lib' )
506
-
507
-
508
- ## メモ ##
509
-
510
- * Rubyスタイルの便利なインターフェースはサポートしていません (ruby-opengl2 ( http://ruby-opengl.rubyforge.org/ ) にあったような感じのもの)
511
- * 例:
512
- * (OpenGLオリジナルの C API)
513
-
514
- GLuint tex_names_buf[2];
515
- glGenTextures( 2, tex_names_buf );
516
- GLuint tex_name = tex_names_buf[0];
517
-
518
- * (このライブラリの場合)
519
-
520
- tex_names_buf = ' ' * 8 # テクスチャ名(GLuint)を受け取るのに十分なサイズ String インスタンスであればOK
521
- glGenTextures( 2, tex_names_buf )
522
- tex_name = tex_names_buf.unpack('L2')[0]
523
-
524
- * (ruby-opengl2 の場合)
525
-
526
- tex_name = glGenTextures( 2 )[0] # glGenTextures が配列を返すように修正されています
527
-
528
- * opengl-bindings を使ったプロジェクト
529
- * ruby-gnome2
530
- * https://github.com/ruby-gnome2/ruby-gnome2
531
- * https://github.com/ruby-gnome2/ruby-gnome2/tree/master/gtk3/sample/misc
532
- * gtkglarea1.rb, gtkglarea2.rb
533
- * FXRuby - A library for cross-platform graphical user interfaces
534
- * https://github.com/larskanis/fxruby/blob/1.6/examples/glviewer.rb
535
- * dxsdl2r
536
- * https://github.com/mirichi/dxsdl2r
537
- * mittsu - A direct port of THREE.js from JavaScript/WebGL to Ruby/OpenGL
538
- * https://rubygems.org/gems/mittsu
539
- * https://github.com/jellymann/mittsu
540
- * opencl-bindings - A Ruby binding for OpenCL 1.2
541
- * https://rubygems.org/gems/opencl-bindings
542
- * https://github.com/vaiorabbit/ruby-opencl
543
- * perfume_dance - A BVH motion parser and playback implementation written in Ruby
544
- * https://github.com/vaiorabbit/perfume_dance
545
- * open.gl.rb - A port of the https://open.gl/ tutorials to Ruby
546
- * https://github.com/mechazoidal/opendotgl_rb
547
-
548
- * 参考になりそうなプロジェクト
549
- * argon | neon
550
- * https://github.com/npomf/argon
551
- * https://bitbucket.org/npomf/neon/src
552
- * "vaiorabbit / ruby-opengl - as the basis for the OpenGL, OpenAL, and GLFW FFI libraries."
553
-
554
-
555
- ## ライセンス ##
556
-
557
- * zlib/libpng ライセンスです ( http://opensource.org/licenses/Zlib )。
558
-
559
- * sample/GLExcess 以下にあるものについては GNU General Public License version 2 です。
560
- sample/GLExcess/GPL2.txt を参照してください。
561
-
562
- * sample/OrangeBook 以下にあるものについては修正BSDライセンスです。
563
- sample/OrangeBook/3Dlabs-License.txt を参照してください。
564
-
1
+ <!-- -*- mode:markdown; coding:utf-8; -*- -->
2
+
3
+ # Yet another OpenGL wrapper for Ruby #
4
+
5
+ ...and wrapper code generator.
6
+
7
+ * Created : 2013-08-28
8
+ * Last modified : 2022-01-08
9
+
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
+
12
+ <img src="https://raw.githubusercontent.com/vaiorabbit/ruby-opengl/master/doc/simple_rb.jpg" width="200"> <img src="https://raw.githubusercontent.com/vaiorabbit/ruby-opengl/master/doc/nehe_lesson36_rb.jpg" width="200"> <img src="https://raw.githubusercontent.com/vaiorabbit/ruby-opengl/master/doc/brick_rb.jpg" width="200"> <img src="https://raw.githubusercontent.com/vaiorabbit/ruby-opengl/master/doc/glxs_rb.jpg" width="200">
13
+
14
+
15
+ ## Features ##
16
+
17
+ * Uses Fiddle (One of the Ruby standard libraries that wraps libffi)
18
+ * Unlike opengl ( https://rubygems.org/gems/opengl ), you don't need to build C extension library
19
+
20
+ * Uses Khronos XML API registry ( https://github.com/KhronosGroup/OpenGL-Registry )
21
+ * The command/enum wrapper codes are generated via 'gl.xml'
22
+ * Supports OpenGL - 4.6, OpenGL ES - 3.1 and all OpenGL extensions.
23
+
24
+
25
+ ## How to install ##
26
+
27
+ Via RubyGems ( https://rubygems.org/gems/opengl-bindings ):
28
+
29
+ $ gem install opengl-bindings
30
+
31
+ Or grab all library codes (`lib/*.rb') and use them by adding as one of the load paths like:
32
+
33
+ $ ruby -I ./lib your_app.rb
34
+
35
+
36
+ ## How to use ##
37
+
38
+ See sample/simple.rb or sample/simple_glut.rb.
39
+
40
+ To get more samples and generator scripts, please visit:
41
+ https://github.com/vaiorabbit/ruby-opengl
42
+
43
+
44
+ ## Contents ##
45
+
46
+ * 'opengl.rb' includes these scripts:
47
+ * 'opengl_command.rb' : OpenGL command wrapper (glDrawRangeElements, etc.). Generated via generator/generate_command.rb.
48
+ * 'opengl_enum.rb' : OpenGL enum wrapper (GL_TRIANGLE_STRIP, etc.). Generated via generator/generate_enum.rb.
49
+ * 'opengl_common.rb' : Provides utility functions.
50
+ * 'opengl_platform.rb' : Provides platform check functions (OpneGL.get_platform).
51
+ * 'opengl_windows.rb' : Provides functions for Windows platform (wglGetProcAddress, wglGetCurrentContext, wglGetCurrentDC).
52
+ * 'opengl_macosx.rb' : Provides functions for Mac OS X platform (CGLGetCurrentContext, CGLGetShareGroup).
53
+ * 'opengl_linux.rb' : Provides functions for Linux (X Window) platform (glXGetCurrentContext, glXGetCurrentDisplay).
54
+
55
+ * 'opengl_es.rb' is almost the same with 'opengl.rb', except for including 'opengl_es_command.rb' and 'opengl_es_enum.rb'.
56
+
57
+ * 'opengl_ext.rb' includes these scripts:
58
+ * 'opengl_ext_command.rb' : OpenGL extension command wrapper. Generated via generator/generate_ext_command.rb.
59
+ * 'opengl_ext_enum.rb' : OpenGL extension enum wrapper Generated via generator/generate_ext_enum.rb.
60
+ * 'opengl_ext_common.rb' : Provides utility functions.
61
+
62
+ * 'opengl_es_ext.rb' is almost the same with 'opengl_ext.rb', except for including 'opengl_es_ext_command.rb' and 'opengl_es_ext_enum.rb'.
63
+
64
+ * 'glfw.rb'
65
+ * My handwritten GLFW wrapper.
66
+
67
+ * 'glut.rb'
68
+ * GLUT wrapper. Supports API Level 4 (GLUT_API_VERSION = 4).
69
+
70
+ * 'glu.rb'
71
+ * My handwritten GLU wrapper.
72
+
73
+ * 'generator/gl.xml'
74
+ * Khronos' official XML API registry for OpenGL.
75
+
76
+ * 'generator/Rakefile'
77
+ * Type 'rake' to generate wrapper codes / fetch gl.xml.
78
+ * You can get the latest one by 'get_gl_xml.rb'.
79
+
80
+ * 'sample/simple.rb', 'sample/simple_glut.rb'
81
+ * Simple example.
82
+ * simple.rb : You need to get glfw3.dll (Windows) or libglfw.dylib (Mac OS X). See sample/README.md.
83
+ * simple_glut.rb : (For Windows uses) You need to get freeglut.dll. See sample/README.md.
84
+
85
+ * 'sample/data', 'sample/util'
86
+ * Data and utilities for sample programs.
87
+
88
+ ## Prerequisites ##
89
+
90
+ * Fiddle
91
+ * A libffi wrapper
92
+ * Standard library since Ruby 2.0.0
93
+ * 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).
94
+
95
+ ### For sample ###
96
+
97
+ Use GLFW or GLUT for creating windows and OpenGL rendering contexts.
98
+
99
+ * GLFW
100
+ * http://www.glfw.org/
101
+ * http://www.glfw.org/download.html
102
+
103
+ * freeglut
104
+ * http://freeglut.sourceforge.net
105
+ * http://freeglut.sourceforge.net/index.php#download
106
+
107
+
108
+ ## Tested Environment ##
109
+
110
+ * Ruby
111
+ * ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [arm64-darwin20]
112
+ * ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x64-mingw32]
113
+ * ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [arm64-darwin20]
114
+ * ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [arm64-darwin20]
115
+ * ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x64-mingw32]
116
+ * ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [arm64-darwin20]
117
+ * ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [arm64-darwin20]
118
+ * ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x64-mingw32]
119
+ * ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19]
120
+ * ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]
121
+ * ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-darwin18]
122
+ * ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-darwin18]
123
+ * ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
124
+ * ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin17]
125
+ * ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
126
+ * ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16]
127
+ * ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
128
+ * ruby 2.3.0p0 (2015-12-25 revision 53290) [x64-mingw32]
129
+ * ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
130
+ * ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
131
+ * ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
132
+ * ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
133
+ * ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
134
+ * ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
135
+ * ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
136
+ * ruby 2.1.2p95 (2014-05-08 revision 45877) [i386-mingw32]
137
+ * ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin12.0]
138
+ * ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-darwin13.0.0]
139
+ * ruby 2.0.0p247 (2013-06-27) [i386-mingw32]
140
+
141
+ * Windows 10 Home, 64-bit (Version 1909, OS Build 18363.778)
142
+ * NVIDIA GeForce RTX 2060 SUPER
143
+ * OpenGL 4.5
144
+
145
+ > ruby report_env.rb
146
+ Version : 4.5.0 NVIDIA 436.30
147
+ Vendor : NVIDIA Corporation
148
+ Renderer : GeForce RTX 2060 SUPER/PCIe/SSE2
149
+ Shader : 4.50 NVIDIA
150
+
151
+ * Windows 10 Home, 64-bit (Version 1511, OS Build 10586.164)
152
+ * NVIDIA GeForce GTX 960
153
+ * OpenGL 4.5
154
+
155
+ > ruby report_env.rb
156
+ Version: 4.5.0 NVIDIA 364.72
157
+
158
+ * Windows 7 Home Premium, 64-bit (Service Pack 1)
159
+ * NVIDIA GeForce GTX 560
160
+ * OpenGL 4.3
161
+
162
+ > ruby report_env.rb
163
+ 4.3.0
164
+
165
+ * Windows 7 Home Premium, 64-bit (Service Pack 1)
166
+ * NVIDIA GeForce GTX 560
167
+ * OpenGL 4.3
168
+
169
+ > ruby report_env.rb
170
+ 4.3.0
171
+
172
+ * Mac OS X 10.8.4, 64-bit
173
+ * NVIDIA GeForce 320M on Mac mini (Mid 2010)
174
+ * OpenGL 2.1
175
+
176
+ $ ruby report_env.rb
177
+ 2.1 NVIDIA-8.12.47 310.40.00.05f01
178
+
179
+ * Mac OS X 10.10.5, 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-10.6.33
185
+
186
+ * Mac OS X 10.15.3, 64-bit
187
+ * Intel Iris on Mac mini (Late 2014)
188
+ * OpenGL 4.1
189
+
190
+ $ ruby report_env.rb
191
+ Version : 4.1 INTEL-14.4.23
192
+ Vendor : Intel Inc.
193
+ Renderer : Intel Iris OpenGL Engine
194
+ Shader : 4.10
195
+
196
+ * macOS 12.1, 64-bit
197
+ * Mac mini (M1 2020)
198
+ * OpenGL 4.1
199
+
200
+ $ ruby report_env.rb
201
+ Version : 4.1 Metal - 76.3
202
+ Vendor : Apple
203
+ Renderer : Apple M1
204
+ Shader : 4.10
205
+
206
+ * Arch Linux kernel 4.1.2-2-ARCH, Nvidia Driver, x86_64
207
+ * NVIDIA GeForce GTS 450
208
+ * OpenGL 4.5.0
209
+
210
+ $ ruby report_env.rb
211
+ Version: 4.5.0 NVIDIA 352.21
212
+
213
+ * Arch Linux kernel 4.1.4-1-ARCH, Nouveau Driver, x86_64
214
+ * NVIDIA GeForce GTS 450
215
+ * OpenGL 3.0
216
+
217
+ $ ruby report_env.rb
218
+ Version: 3.0 Mesa 10.6.3
219
+
220
+ * You can use any lib/path names by passing as arguments like:
221
+ * OpenGL.load_lib( 'libGL.so', '/usr/lib' )
222
+ * GLFW.load_lib( 'libglfw.so', '/usr/lib' )
223
+ * GLU.load_lib( 'libGLU.so', '/usr/lib' )
224
+ * GLUT.load_lib( 'libglut.so', '/usr/lib' )
225
+
226
+ ## Note ##
227
+
228
+ * No Ruby-Style handy interfaces are available (like one in the ruby-opengl2 ( http://ruby-opengl.rubyforge.org/ ))
229
+ * Example:
230
+ * (Original C API)
231
+
232
+ GLuint tex_names_buf[2];
233
+ glGenTextures( 2, tex_names_buf );
234
+ GLuint tex_name = tex_names_buf[0];
235
+
236
+ * (This library)
237
+
238
+ tex_names_buf = ' ' * 8 # String instance that is enough to catch texture names (integer).
239
+ glGenTextures( 2, tex_names_buf )
240
+ tex_name = tex_names_buf.unpack('L2')[0]
241
+
242
+ * (ruby-opengl2)
243
+
244
+ tex_name = glGenTextures( 2 )[0]
245
+
246
+ * Projects using opengl-bindings
247
+ * ruby-gnome2
248
+ * https://github.com/ruby-gnome2/ruby-gnome2
249
+ * https://github.com/ruby-gnome2/ruby-gnome2/tree/master/gtk3/sample/misc
250
+ * gtkglarea1.rb, gtkglarea2.rb
251
+ * FXRuby - A library for cross-platform graphical user interfaces
252
+ * https://github.com/larskanis/fxruby/blob/1.6/examples/glviewer.rb
253
+ * dxsdl2r
254
+ * https://github.com/mirichi/dxsdl2r
255
+ * mittsu - A direct port of THREE.js from JavaScript/WebGL to Ruby/OpenGL
256
+ * https://rubygems.org/gems/mittsu
257
+ * https://github.com/jellymann/mittsu
258
+ * opencl-bindings - A Ruby binding for OpenCL 1.2
259
+ * https://rubygems.org/gems/opencl-bindings
260
+ * https://github.com/vaiorabbit/ruby-opencl
261
+ * perfume_dance - A BVH motion parser and playback implementation written in Ruby
262
+ * https://github.com/vaiorabbit/perfume_dance
263
+ * open.gl.rb - A port of the https://open.gl/ tutorials to Ruby
264
+ * https://github.com/mechazoidal/opendotgl_rb
265
+
266
+ * Other informative projects
267
+ * argon | neon
268
+ * https://github.com/npomf/argon
269
+ * https://bitbucket.org/npomf/neon/src
270
+ * "vaiorabbit / ruby-opengl - as the basis for the OpenGL, OpenAL, and GLFW FFI libraries."
271
+
272
+ ## License ##
273
+
274
+ The zlib/libpng License ( http://opensource.org/licenses/Zlib ).
275
+
276
+ Copyright (c) 2013-2020 vaiorabbit <http://twitter.com/vaiorabbit>
277
+
278
+ This software is provided 'as-is', without any express or implied
279
+ warranty. In no event will the authors be held liable for any damages
280
+ arising from the use of this software.
281
+
282
+ Permission is granted to anyone to use this software for any purpose,
283
+ including commercial applications, and to alter it and redistribute it
284
+ freely, subject to the following restrictions:
285
+
286
+ 1. The origin of this software must not be misrepresented; you must not
287
+ claim that you wrote the original software. If you use this software in a
288
+ product, an acknowledgment in the product documentation would be
289
+ appreciated but is not required.
290
+
291
+ 2. Altered source versions must be plainly marked as such, and must not be
292
+ misrepresented as being the original software.
293
+
294
+ 3. This notice may not be removed or altered from any source distribution.
295
+
296
+ Sample codes/resources under sample/GLExcess are provided under the GNU General
297
+ Public License version 2. See sample/GLExcess/GPL2.txt .
298
+
299
+ Sample codes under sample/OrangeBook are provided under the BSD 3-Clause License.
300
+ See sample/OrangeBook/3Dlabs-License.txt .
301
+
302
+ -------------------------------------------------------------------------------
303
+
304
+ # Ruby 用 OpenGL ラッパー (とその自動生成スクリプト) #
305
+
306
+ ## 特徴 ##
307
+
308
+ * 標準ライブラリ Fiddle を使っています ⇒ opengl ( https://rubygems.org/gems/opengl ) のように拡張ライブラリをビルドする必要がありません
309
+ * 関数とenumのラッパーコードは Khronos の XML API registry ( https://github.com/KhronosGroup/OpenGL-Registry ) の gl.xml から自動生成しています
310
+
311
+
312
+ ## インストール ##
313
+
314
+ RubyGems経由で ( https://rubygems.org/gems/opengl-bindings ):
315
+
316
+ $ gem install opengl-bindings
317
+
318
+ もしくは lib 以下の *.rb をコピー → その場所をロードパスに加えて次のように起動:
319
+
320
+ $ ruby -I ./lib your_app.rb
321
+
322
+
323
+ ## 使い方 ##
324
+
325
+ sample/simple.rb または sample/simple_glut.rb を参照してください。
326
+
327
+ その他のサンプルと自動生成スクリプトはこちらで開発しています:
328
+ https://github.com/vaiorabbit/ruby-opengl
329
+
330
+
331
+ ## 内容 ##
332
+
333
+ * 'opengl.rb' を require することで下記のスクリプトを取り込みます:
334
+ * 'opengl_command.rb' : OpenGL 関数のラッパーコード (glDrawRangeElements, etc.)。 generator/generate_command.rb で自動生成されたものです。
335
+ * 'opengl_enum.rb' : OpenGL enum のラッパーコード (GL_TRIANGLE_STRIP, etc.)。 generator/generate_enum.rb で自動生成されたものです。
336
+ * 'opengl_common.rb' : 共通のユーティリティ関数を提供しています。
337
+ * 'opengl_platform.rb' : 動作プラットフォームの判別機能を提供しています (OpneGL.get_platform)。
338
+ * 'opengl_windows.rb' : Windows 用の機能を提供しています (wglGetProcAddress, wglGetCurrentContext, wglGetCurrentDC).
339
+ * 'opengl_macosx.rb' : Mac OS X 用の機能を提供しています (CGLGetCurrentContext, CGLGetShareGroup).
340
+ * 'opengl_linux.rb' : Linux (X Window) 用の機能を提供しています (glXGetCurrentContext, glXGetCurrentDisplay).
341
+
342
+ * 'opengl_es.rb' は 'opengl_es_command.rb' と 'opengl_es_enum.rb' を取り込む以外は 'opengl.rb' と同じです。
343
+
344
+ * 'opengl_ext.rb' を require することで下記のスクリプトを取り込みます:
345
+ * 'opengl_ext_command.rb' : OpenGL 拡張関数のラッパーコード。 generator/generate_ext_command.rb で自動生成されたものです。
346
+ * 'opengl_ext_enum.rb' : OpenGL 拡張enumのラッパーコード。 generator/generate_ext_enum.rb で自動生成されたものです。
347
+
348
+ * 'opengl_es_ext.rb' は 'opengl_es_ext_command.rb' と 'opengl_es_ext_enum.rb' を取り込む以外は 'opengl_ext.rb' と同じです。
349
+
350
+ * 'glfw.rb'
351
+ * GLFW のラッパーコードです(自動生成ではありません)。
352
+
353
+ * 'glut.rb'
354
+ * GLUT ラッパー。API Level 4 までサポートしています (GLUT_API_VERSION = 4)。
355
+
356
+
357
+ * 'glu.rb'
358
+ * GLU のラッパーコードです(自動生成ではありません)。
359
+
360
+ * 'generator/gl.xml'
361
+ * Khronos 公式の XML API registry です。
362
+
363
+ * 'generator/Rakefile'
364
+ * 自動生成関連のタスクを自動化するためのものです。'rake' と打てば gl.xml の取得とラッパーコードの生成を実行します。
365
+ * gl.xml の取得だけなど、単体のタスクなら 'get_gl_xml.rb' などの個別Rubyスクリプトでも実行できます。
366
+
367
+ * 'sample/simple.rb', 'sample/simple_glut.rb'
368
+ * 一番簡単なサンプルです。
369
+ * simple.rb : 同じ場所に glfw3.dll (Windows) もしくは libglfw.dylib (Mac OS X) を置いてください。詳細は sample/README.md に記載されています。
370
+ * simple_glut.rb : (Windows の場合) freeglut.dll を置いてください。詳細は sample/README.md に記載されています。
371
+
372
+ * 'sample/data', 'sample/util'
373
+ * サンプルで共有する機能・データの配置場所です。
374
+
375
+
376
+ ## 必要なもの ##
377
+
378
+ * Fiddle
379
+ * libffi のラッパーです
380
+ * Ruby 2.0.0 以降で標準ライブラリになりました
381
+ * Fiddle のメモリリーク問題 (https://bugs.ruby-lang.org/issues/9599) が修正された Ruby 2.1.2 以降での利用を推奨します
382
+
383
+ ### サンプル用 ###
384
+
385
+ GLFW か GLUT を用意してください。ウィンドウやレンダリングコンテキストの管理に必要です。
386
+
387
+ * GLFW
388
+ * http://www.glfw.org/
389
+ * http://www.glfw.org/download.html
390
+
391
+ * freeglut
392
+ * http://freeglut.sourceforge.net
393
+ * http://freeglut.sourceforge.net/index.php#download
394
+
395
+
396
+ ## テストした環境 ##
397
+
398
+ * Ruby
399
+ * ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [arm64-darwin20]
400
+ * ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x64-mingw32]
401
+ * ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [arm64-darwin20]
402
+ * ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [arm64-darwin20]
403
+ * ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x64-mingw32]
404
+ * ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [arm64-darwin20]
405
+ * ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [arm64-darwin20]
406
+ * ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x64-mingw32]
407
+ * ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19]
408
+ * ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]
409
+ * ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-darwin18]
410
+ * ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-darwin18]
411
+ * ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17]
412
+ * ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin17]
413
+ * ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
414
+ * ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16]
415
+ * ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
416
+ * ruby 2.3.0p0 (2015-12-25 revision 53290) [x64-mingw32]
417
+ * ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
418
+ * ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
419
+ * ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
420
+ * ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
421
+ * ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
422
+ * ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
423
+ * ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
424
+ * ruby 2.1.2p95 (2014-05-08 revision 45877) [i386-mingw32]
425
+ * ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin12.0]
426
+ * ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-darwin13.0.0]
427
+ * ruby 2.0.0p247 (2013-06-27) [i386-mingw32]
428
+
429
+ * Windows 10 Home, 64-bit (Version 1909, OS Build 18363.778)
430
+ * NVIDIA GeForce RTX 2060 SUPER
431
+ * OpenGL 4.5
432
+
433
+ > ruby report_env.rb
434
+ Version : 4.5.0 NVIDIA 436.30
435
+ Vendor : NVIDIA Corporation
436
+ Renderer : GeForce RTX 2060 SUPER/PCIe/SSE2
437
+ Shader : 4.50 NVIDIA
438
+
439
+ * Windows 10 Home, 64-bit (Version 1511, OS Build 10586.164)
440
+ * NVIDIA GeForce GTX 960
441
+ * OpenGL 4.5
442
+
443
+ > ruby report_env.rb
444
+ Version: 4.5.0 NVIDIA 364.72
445
+
446
+ * Windows 7 Home Premium, 64-bit (Service Pack 1)
447
+ * NVIDIA GeForce GTX 560
448
+ * OpenGL 4.3
449
+
450
+ > ruby report_env.rb
451
+ 4.3.0
452
+
453
+ * Mac OS X 10.8.4, 64-bit
454
+ * NVIDIA GeForce 320M on Mac mini (Mid 2010)
455
+ * OpenGL 2.1
456
+
457
+ $ ruby report_env.rb
458
+ 2.1 NVIDIA-8.12.47 310.40.00.05f01
459
+
460
+ * Mac OS X 10.10.5, 64-bit
461
+ * Intel Iris on Mac mini (Late 2014)
462
+ * OpenGL 4.1
463
+
464
+ $ ruby report_env.rb
465
+ Version: 4.1 INTEL-10.6.33
466
+
467
+ * Mac OS X 10.15.3, 64-bit
468
+ * Intel Iris on Mac mini (Late 2014)
469
+ * OpenGL 4.1
470
+
471
+ $ ruby report_env.rb
472
+ Version : 4.1 INTEL-14.4.23
473
+ Vendor : Intel Inc.
474
+ Renderer : Intel Iris OpenGL Engine
475
+ Shader : 4.10
476
+
477
+ * macOS 12.1, 64-bit
478
+ * Mac mini (M1 2020)
479
+ * OpenGL 4.1
480
+
481
+ $ ruby report_env.rb
482
+ Version : 4.1 Metal - 76.3
483
+ Vendor : Apple
484
+ Renderer : Apple M1
485
+ Shader : 4.10
486
+
487
+ * Arch Linux kernel 4.1.2-2-ARCH, Nvidia Driver, x86_64
488
+ * NVIDIA GeForce GTS 450
489
+ * OpenGL 4.5.0
490
+
491
+ $ ruby report_env.rb
492
+ Version: 4.5.0 NVIDIA 352.21
493
+
494
+ * Arch Linux kernel 4.1.4-1-ARCH, Nouveau Driver, x86_64
495
+ * NVIDIA GeForce GTS 450
496
+ * OpenGL 3.0
497
+
498
+ $ ruby report_env.rb
499
+ Version: 3.0 Mesa 10.6.3
500
+
501
+ * 引数として渡すことで任意のライブラリ名/パス名を利用できます:
502
+ * OpenGL.load_lib( 'libGL.so', '/usr/lib' )
503
+ * GLFW.load_lib( 'libglfw.so', '/usr/lib' )
504
+ * GLU.load_lib( 'libGLU.so', '/usr/lib' )
505
+ * GLUT.load_lib( 'libglut.so', '/usr/lib' )
506
+
507
+
508
+ ## メモ ##
509
+
510
+ * Rubyスタイルの便利なインターフェースはサポートしていません (ruby-opengl2 ( http://ruby-opengl.rubyforge.org/ ) にあったような感じのもの)
511
+ * 例:
512
+ * (OpenGLオリジナルの C API)
513
+
514
+ GLuint tex_names_buf[2];
515
+ glGenTextures( 2, tex_names_buf );
516
+ GLuint tex_name = tex_names_buf[0];
517
+
518
+ * (このライブラリの場合)
519
+
520
+ tex_names_buf = ' ' * 8 # テクスチャ名(GLuint)を受け取るのに十分なサイズ String インスタンスであればOK
521
+ glGenTextures( 2, tex_names_buf )
522
+ tex_name = tex_names_buf.unpack('L2')[0]
523
+
524
+ * (ruby-opengl2 の場合)
525
+
526
+ tex_name = glGenTextures( 2 )[0] # glGenTextures が配列を返すように修正されています
527
+
528
+ * opengl-bindings を使ったプロジェクト
529
+ * ruby-gnome2
530
+ * https://github.com/ruby-gnome2/ruby-gnome2
531
+ * https://github.com/ruby-gnome2/ruby-gnome2/tree/master/gtk3/sample/misc
532
+ * gtkglarea1.rb, gtkglarea2.rb
533
+ * FXRuby - A library for cross-platform graphical user interfaces
534
+ * https://github.com/larskanis/fxruby/blob/1.6/examples/glviewer.rb
535
+ * dxsdl2r
536
+ * https://github.com/mirichi/dxsdl2r
537
+ * mittsu - A direct port of THREE.js from JavaScript/WebGL to Ruby/OpenGL
538
+ * https://rubygems.org/gems/mittsu
539
+ * https://github.com/jellymann/mittsu
540
+ * opencl-bindings - A Ruby binding for OpenCL 1.2
541
+ * https://rubygems.org/gems/opencl-bindings
542
+ * https://github.com/vaiorabbit/ruby-opencl
543
+ * perfume_dance - A BVH motion parser and playback implementation written in Ruby
544
+ * https://github.com/vaiorabbit/perfume_dance
545
+ * open.gl.rb - A port of the https://open.gl/ tutorials to Ruby
546
+ * https://github.com/mechazoidal/opendotgl_rb
547
+
548
+ * 参考になりそうなプロジェクト
549
+ * argon | neon
550
+ * https://github.com/npomf/argon
551
+ * https://bitbucket.org/npomf/neon/src
552
+ * "vaiorabbit / ruby-opengl - as the basis for the OpenGL, OpenAL, and GLFW FFI libraries."
553
+
554
+
555
+ ## ライセンス ##
556
+
557
+ * zlib/libpng ライセンスです ( http://opensource.org/licenses/Zlib )。
558
+
559
+ * sample/GLExcess 以下にあるものについては GNU General Public License version 2 です。
560
+ sample/GLExcess/GPL2.txt を参照してください。
561
+
562
+ * sample/OrangeBook 以下にあるものについては修正BSDライセンスです。
563
+ sample/OrangeBook/3Dlabs-License.txt を参照してください。
564
+