opengl-bindings2 2.0.3 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ChangeLog +755 -751
- data/README.md +757 -757
- data/lib/glfw.rb +759 -759
- data/lib/glfw33.rb +704 -704
- data/lib/glu.rb +366 -366
- data/lib/glut.rb +575 -575
- data/lib/opengl.rb +36 -36
- data/lib/opengl_command.rb +7356 -7356
- data/lib/opengl_common.rb +83 -81
- data/lib/opengl_enum.rb +1818 -1818
- data/lib/opengl_es.rb +31 -31
- data/lib/opengl_es_command.rb +2526 -2526
- data/lib/opengl_es_enum.rb +1011 -1011
- data/lib/opengl_es_ext.rb +28 -28
- data/lib/opengl_es_ext_command.rb +9292 -9292
- data/lib/opengl_es_ext_enum.rb +6304 -6304
- data/lib/opengl_ext.rb +28 -28
- data/lib/opengl_ext_command.rb +33390 -33390
- data/lib/opengl_ext_common.rb +52 -52
- data/lib/opengl_ext_enum.rb +14164 -14164
- data/lib/opengl_linux.rb +63 -63
- data/lib/opengl_macosx.rb +68 -68
- data/lib/opengl_platform.rb +43 -43
- data/lib/opengl_windows.rb +71 -71
- data/sample/README.md +55 -55
- data/sample/glfw_get.bat +6 -6
- data/sample/glfw_get.sh +3 -3
- data/sample/simple.rb +57 -57
- metadata +2 -2
data/lib/opengl_linux.rb
CHANGED
@@ -1,63 +1,63 @@
|
|
1
|
-
require 'fiddle'
|
2
|
-
|
3
|
-
module GL
|
4
|
-
|
5
|
-
GLX_FUNCTIONS_MAP = {}
|
6
|
-
GLX_FUNCTIONS_ARGS_MAP = {}
|
7
|
-
GLX_FUNCTIONS_RETVAL_MAP = {}
|
8
|
-
|
9
|
-
def self.get_glx_command(sym)
|
10
|
-
if GLX_FUNCTIONS_MAP[sym] == nil
|
11
|
-
bind_glx_command(sym)
|
12
|
-
end
|
13
|
-
return GLX_FUNCTIONS_MAP[sym]
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.bind_glx_command(sym)
|
17
|
-
GLX_FUNCTIONS_MAP[sym] = Fiddle::Function.new(@@gl_dll[sym.to_s],
|
18
|
-
GLX_FUNCTIONS_ARGS_MAP[sym],
|
19
|
-
GLX_FUNCTIONS_RETVAL_MAP[sym])
|
20
|
-
raise RuntimeError if GLX_FUNCTIONS_RETVAL_MAP[sym] == nil
|
21
|
-
end
|
22
|
-
|
23
|
-
GLX_FUNCTIONS_ARGS_MAP[:glXGetCurrentContext] = []
|
24
|
-
GLX_FUNCTIONS_RETVAL_MAP[:glXGetCurrentContext] = Fiddle::TYPE_VOIDP
|
25
|
-
|
26
|
-
def glXGetCurrentContext()
|
27
|
-
f = GL::get_glx_command(:glXGetCurrentContext)
|
28
|
-
f.call()
|
29
|
-
end
|
30
|
-
|
31
|
-
GLX_FUNCTIONS_ARGS_MAP[:glXGetCurrentDisplay] = [Fiddle::TYPE_VOIDP]
|
32
|
-
GLX_FUNCTIONS_RETVAL_MAP[:glXGetCurrentDisplay] = Fiddle::TYPE_VOIDP
|
33
|
-
|
34
|
-
def glXGetCurrentDisplay(_glx_ctxobj_)
|
35
|
-
f = GL::get_glx_command(:glXGetCurrentDisplay)
|
36
|
-
f.call(_glx_ctxobj_)
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
=begin
|
42
|
-
Ruby-OpenGL : Yet another OpenGL wrapper for Ruby (and wrapper code generator)
|
43
|
-
Copyright (c) 2013-2025 vaiorabbit <http://twitter.com/vaiorabbit>
|
44
|
-
|
45
|
-
This software is provided 'as-is', without any express or implied
|
46
|
-
warranty. In no event will the authors be held liable for any damages
|
47
|
-
arising from the use of this software.
|
48
|
-
|
49
|
-
Permission is granted to anyone to use this software for any purpose,
|
50
|
-
including commercial applications, and to alter it and redistribute it
|
51
|
-
freely, subject to the following restrictions:
|
52
|
-
|
53
|
-
1. The origin of this software must not be misrepresented; you must not
|
54
|
-
claim that you wrote the original software. If you use this software
|
55
|
-
in a product, an acknowledgment in the product documentation would be
|
56
|
-
appreciated but is not required.
|
57
|
-
|
58
|
-
2. Altered source versions must be plainly marked as such, and must not be
|
59
|
-
misrepresented as being the original software.
|
60
|
-
|
61
|
-
3. This notice may not be removed or altered from any source
|
62
|
-
distribution.
|
63
|
-
=end
|
1
|
+
require 'fiddle'
|
2
|
+
|
3
|
+
module GL
|
4
|
+
|
5
|
+
GLX_FUNCTIONS_MAP = {}
|
6
|
+
GLX_FUNCTIONS_ARGS_MAP = {}
|
7
|
+
GLX_FUNCTIONS_RETVAL_MAP = {}
|
8
|
+
|
9
|
+
def self.get_glx_command(sym)
|
10
|
+
if GLX_FUNCTIONS_MAP[sym] == nil
|
11
|
+
bind_glx_command(sym)
|
12
|
+
end
|
13
|
+
return GLX_FUNCTIONS_MAP[sym]
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.bind_glx_command(sym)
|
17
|
+
GLX_FUNCTIONS_MAP[sym] = Fiddle::Function.new(@@gl_dll[sym.to_s],
|
18
|
+
GLX_FUNCTIONS_ARGS_MAP[sym],
|
19
|
+
GLX_FUNCTIONS_RETVAL_MAP[sym])
|
20
|
+
raise RuntimeError if GLX_FUNCTIONS_RETVAL_MAP[sym] == nil
|
21
|
+
end
|
22
|
+
|
23
|
+
GLX_FUNCTIONS_ARGS_MAP[:glXGetCurrentContext] = []
|
24
|
+
GLX_FUNCTIONS_RETVAL_MAP[:glXGetCurrentContext] = Fiddle::TYPE_VOIDP
|
25
|
+
|
26
|
+
def glXGetCurrentContext()
|
27
|
+
f = GL::get_glx_command(:glXGetCurrentContext)
|
28
|
+
f.call()
|
29
|
+
end
|
30
|
+
|
31
|
+
GLX_FUNCTIONS_ARGS_MAP[:glXGetCurrentDisplay] = [Fiddle::TYPE_VOIDP]
|
32
|
+
GLX_FUNCTIONS_RETVAL_MAP[:glXGetCurrentDisplay] = Fiddle::TYPE_VOIDP
|
33
|
+
|
34
|
+
def glXGetCurrentDisplay(_glx_ctxobj_)
|
35
|
+
f = GL::get_glx_command(:glXGetCurrentDisplay)
|
36
|
+
f.call(_glx_ctxobj_)
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
=begin
|
42
|
+
Ruby-OpenGL : Yet another OpenGL wrapper for Ruby (and wrapper code generator)
|
43
|
+
Copyright (c) 2013-2025 vaiorabbit <http://twitter.com/vaiorabbit>
|
44
|
+
|
45
|
+
This software is provided 'as-is', without any express or implied
|
46
|
+
warranty. In no event will the authors be held liable for any damages
|
47
|
+
arising from the use of this software.
|
48
|
+
|
49
|
+
Permission is granted to anyone to use this software for any purpose,
|
50
|
+
including commercial applications, and to alter it and redistribute it
|
51
|
+
freely, subject to the following restrictions:
|
52
|
+
|
53
|
+
1. The origin of this software must not be misrepresented; you must not
|
54
|
+
claim that you wrote the original software. If you use this software
|
55
|
+
in a product, an acknowledgment in the product documentation would be
|
56
|
+
appreciated but is not required.
|
57
|
+
|
58
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
59
|
+
misrepresented as being the original software.
|
60
|
+
|
61
|
+
3. This notice may not be removed or altered from any source
|
62
|
+
distribution.
|
63
|
+
=end
|
data/lib/opengl_macosx.rb
CHANGED
@@ -1,68 +1,68 @@
|
|
1
|
-
require 'fiddle'
|
2
|
-
|
3
|
-
module GL
|
4
|
-
|
5
|
-
CGL_FUNCTIONS_MAP = {}
|
6
|
-
CGL_FUNCTIONS_ARGS_MAP = {}
|
7
|
-
CGL_FUNCTIONS_RETVAL_MAP = {}
|
8
|
-
|
9
|
-
@@cgl_dll = nil
|
10
|
-
|
11
|
-
def self.get_cgl_command(sym)
|
12
|
-
if @@cgl_dll == nil
|
13
|
-
@@cgl_dll = Fiddle.dlopen('/System/Library/Frameworks/OpenGL.framework/OpenGL')
|
14
|
-
end
|
15
|
-
if CGL_FUNCTIONS_MAP[sym] == nil
|
16
|
-
bind_cgl_command(sym)
|
17
|
-
end
|
18
|
-
return CGL_FUNCTIONS_MAP[sym]
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.bind_cgl_command(sym)
|
22
|
-
CGL_FUNCTIONS_MAP[sym] = Fiddle::Function.new(@@cgl_dll[sym.to_s],
|
23
|
-
CGL_FUNCTIONS_ARGS_MAP[sym],
|
24
|
-
CGL_FUNCTIONS_RETVAL_MAP[sym])
|
25
|
-
raise RuntimeError if CGL_FUNCTIONS_RETVAL_MAP[sym] == nil
|
26
|
-
end
|
27
|
-
|
28
|
-
CGL_FUNCTIONS_ARGS_MAP[:CGLGetCurrentContext] = []
|
29
|
-
CGL_FUNCTIONS_RETVAL_MAP[:CGLGetCurrentContext] = Fiddle::TYPE_VOIDP
|
30
|
-
|
31
|
-
def CGLGetCurrentContext()
|
32
|
-
f = GL::get_cgl_command(:CGLGetCurrentContext)
|
33
|
-
f.call()
|
34
|
-
end
|
35
|
-
|
36
|
-
CGL_FUNCTIONS_ARGS_MAP[:CGLGetShareGroup] = [Fiddle::TYPE_VOIDP]
|
37
|
-
CGL_FUNCTIONS_RETVAL_MAP[:CGLGetShareGroup] = Fiddle::TYPE_VOIDP
|
38
|
-
|
39
|
-
def CGLGetShareGroup(_cgl_ctxobj_)
|
40
|
-
f = GL::get_cgl_command(:CGLGetShareGroup)
|
41
|
-
f.call(_cgl_ctxobj_)
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
|
-
=begin
|
47
|
-
Ruby-OpenGL : Yet another OpenGL wrapper for Ruby (and wrapper code generator)
|
48
|
-
Copyright (c) 2013-2025 vaiorabbit <http://twitter.com/vaiorabbit>
|
49
|
-
|
50
|
-
This software is provided 'as-is', without any express or implied
|
51
|
-
warranty. In no event will the authors be held liable for any damages
|
52
|
-
arising from the use of this software.
|
53
|
-
|
54
|
-
Permission is granted to anyone to use this software for any purpose,
|
55
|
-
including commercial applications, and to alter it and redistribute it
|
56
|
-
freely, subject to the following restrictions:
|
57
|
-
|
58
|
-
1. The origin of this software must not be misrepresented; you must not
|
59
|
-
claim that you wrote the original software. If you use this software
|
60
|
-
in a product, an acknowledgment in the product documentation would be
|
61
|
-
appreciated but is not required.
|
62
|
-
|
63
|
-
2. Altered source versions must be plainly marked as such, and must not be
|
64
|
-
misrepresented as being the original software.
|
65
|
-
|
66
|
-
3. This notice may not be removed or altered from any source
|
67
|
-
distribution.
|
68
|
-
=end
|
1
|
+
require 'fiddle'
|
2
|
+
|
3
|
+
module GL
|
4
|
+
|
5
|
+
CGL_FUNCTIONS_MAP = {}
|
6
|
+
CGL_FUNCTIONS_ARGS_MAP = {}
|
7
|
+
CGL_FUNCTIONS_RETVAL_MAP = {}
|
8
|
+
|
9
|
+
@@cgl_dll = nil
|
10
|
+
|
11
|
+
def self.get_cgl_command(sym)
|
12
|
+
if @@cgl_dll == nil
|
13
|
+
@@cgl_dll = Fiddle.dlopen('/System/Library/Frameworks/OpenGL.framework/OpenGL')
|
14
|
+
end
|
15
|
+
if CGL_FUNCTIONS_MAP[sym] == nil
|
16
|
+
bind_cgl_command(sym)
|
17
|
+
end
|
18
|
+
return CGL_FUNCTIONS_MAP[sym]
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.bind_cgl_command(sym)
|
22
|
+
CGL_FUNCTIONS_MAP[sym] = Fiddle::Function.new(@@cgl_dll[sym.to_s],
|
23
|
+
CGL_FUNCTIONS_ARGS_MAP[sym],
|
24
|
+
CGL_FUNCTIONS_RETVAL_MAP[sym])
|
25
|
+
raise RuntimeError if CGL_FUNCTIONS_RETVAL_MAP[sym] == nil
|
26
|
+
end
|
27
|
+
|
28
|
+
CGL_FUNCTIONS_ARGS_MAP[:CGLGetCurrentContext] = []
|
29
|
+
CGL_FUNCTIONS_RETVAL_MAP[:CGLGetCurrentContext] = Fiddle::TYPE_VOIDP
|
30
|
+
|
31
|
+
def CGLGetCurrentContext()
|
32
|
+
f = GL::get_cgl_command(:CGLGetCurrentContext)
|
33
|
+
f.call()
|
34
|
+
end
|
35
|
+
|
36
|
+
CGL_FUNCTIONS_ARGS_MAP[:CGLGetShareGroup] = [Fiddle::TYPE_VOIDP]
|
37
|
+
CGL_FUNCTIONS_RETVAL_MAP[:CGLGetShareGroup] = Fiddle::TYPE_VOIDP
|
38
|
+
|
39
|
+
def CGLGetShareGroup(_cgl_ctxobj_)
|
40
|
+
f = GL::get_cgl_command(:CGLGetShareGroup)
|
41
|
+
f.call(_cgl_ctxobj_)
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
=begin
|
47
|
+
Ruby-OpenGL : Yet another OpenGL wrapper for Ruby (and wrapper code generator)
|
48
|
+
Copyright (c) 2013-2025 vaiorabbit <http://twitter.com/vaiorabbit>
|
49
|
+
|
50
|
+
This software is provided 'as-is', without any express or implied
|
51
|
+
warranty. In no event will the authors be held liable for any damages
|
52
|
+
arising from the use of this software.
|
53
|
+
|
54
|
+
Permission is granted to anyone to use this software for any purpose,
|
55
|
+
including commercial applications, and to alter it and redistribute it
|
56
|
+
freely, subject to the following restrictions:
|
57
|
+
|
58
|
+
1. The origin of this software must not be misrepresented; you must not
|
59
|
+
claim that you wrote the original software. If you use this software
|
60
|
+
in a product, an acknowledgment in the product documentation would be
|
61
|
+
appreciated but is not required.
|
62
|
+
|
63
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
64
|
+
misrepresented as being the original software.
|
65
|
+
|
66
|
+
3. This notice may not be removed or altered from any source
|
67
|
+
distribution.
|
68
|
+
=end
|
data/lib/opengl_platform.rb
CHANGED
@@ -1,43 +1,43 @@
|
|
1
|
-
require 'rbconfig'
|
2
|
-
|
3
|
-
module GL
|
4
|
-
@@opengl_platform = case RbConfig::CONFIG['host_os']
|
5
|
-
when /mswin|msys|mingw|cygwin/
|
6
|
-
:OPENGL_PLATFORM_WINDOWS
|
7
|
-
when /darwin/
|
8
|
-
:OPENGL_PLATFORM_MACOSX
|
9
|
-
when /linux/
|
10
|
-
:OPENGL_PLATFORM_LINUX
|
11
|
-
else
|
12
|
-
raise RuntimeError, "OpenGL : Unknown OS: #{host_os.inspect}"
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.get_platform()
|
16
|
-
return @@opengl_platform
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
=begin
|
22
|
-
Ruby-OpenGL : Yet another OpenGL wrapper for Ruby (and wrapper code generator)
|
23
|
-
Copyright (c) 2013-2025 vaiorabbit <http://twitter.com/vaiorabbit>
|
24
|
-
|
25
|
-
This software is provided 'as-is', without any express or implied
|
26
|
-
warranty. In no event will the authors be held liable for any damages
|
27
|
-
arising from the use of this software.
|
28
|
-
|
29
|
-
Permission is granted to anyone to use this software for any purpose,
|
30
|
-
including commercial applications, and to alter it and redistribute it
|
31
|
-
freely, subject to the following restrictions:
|
32
|
-
|
33
|
-
1. The origin of this software must not be misrepresented; you must not
|
34
|
-
claim that you wrote the original software. If you use this software
|
35
|
-
in a product, an acknowledgment in the product documentation would be
|
36
|
-
appreciated but is not required.
|
37
|
-
|
38
|
-
2. Altered source versions must be plainly marked as such, and must not be
|
39
|
-
misrepresented as being the original software.
|
40
|
-
|
41
|
-
3. This notice may not be removed or altered from any source
|
42
|
-
distribution.
|
43
|
-
=end
|
1
|
+
require 'rbconfig'
|
2
|
+
|
3
|
+
module GL
|
4
|
+
@@opengl_platform = case RbConfig::CONFIG['host_os']
|
5
|
+
when /mswin|msys|mingw|cygwin/
|
6
|
+
:OPENGL_PLATFORM_WINDOWS
|
7
|
+
when /darwin/
|
8
|
+
:OPENGL_PLATFORM_MACOSX
|
9
|
+
when /linux/
|
10
|
+
:OPENGL_PLATFORM_LINUX
|
11
|
+
else
|
12
|
+
raise RuntimeError, "OpenGL : Unknown OS: #{host_os.inspect}"
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.get_platform()
|
16
|
+
return @@opengl_platform
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
=begin
|
22
|
+
Ruby-OpenGL : Yet another OpenGL wrapper for Ruby (and wrapper code generator)
|
23
|
+
Copyright (c) 2013-2025 vaiorabbit <http://twitter.com/vaiorabbit>
|
24
|
+
|
25
|
+
This software is provided 'as-is', without any express or implied
|
26
|
+
warranty. In no event will the authors be held liable for any damages
|
27
|
+
arising from the use of this software.
|
28
|
+
|
29
|
+
Permission is granted to anyone to use this software for any purpose,
|
30
|
+
including commercial applications, and to alter it and redistribute it
|
31
|
+
freely, subject to the following restrictions:
|
32
|
+
|
33
|
+
1. The origin of this software must not be misrepresented; you must not
|
34
|
+
claim that you wrote the original software. If you use this software
|
35
|
+
in a product, an acknowledgment in the product documentation would be
|
36
|
+
appreciated but is not required.
|
37
|
+
|
38
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
39
|
+
misrepresented as being the original software.
|
40
|
+
|
41
|
+
3. This notice may not be removed or altered from any source
|
42
|
+
distribution.
|
43
|
+
=end
|
data/lib/opengl_windows.rb
CHANGED
@@ -1,71 +1,71 @@
|
|
1
|
-
require 'fiddle'
|
2
|
-
|
3
|
-
module GL
|
4
|
-
|
5
|
-
WGL_FUNCTIONS_MAP = {}
|
6
|
-
WGL_FUNCTIONS_ARGS_MAP = {}
|
7
|
-
WGL_FUNCTIONS_RETVAL_MAP = {}
|
8
|
-
|
9
|
-
def self.get_wgl_command(sym)
|
10
|
-
if WGL_FUNCTIONS_MAP[sym] == nil
|
11
|
-
bind_wgl_command(sym)
|
12
|
-
end
|
13
|
-
return WGL_FUNCTIONS_MAP[sym]
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.bind_wgl_command(sym)
|
17
|
-
WGL_FUNCTIONS_MAP[sym] = Fiddle::Function.new(@@gl_dll[sym.to_s],
|
18
|
-
WGL_FUNCTIONS_ARGS_MAP[sym],
|
19
|
-
WGL_FUNCTIONS_RETVAL_MAP[sym])
|
20
|
-
raise RuntimeError if WGL_FUNCTIONS_RETVAL_MAP[sym] == nil
|
21
|
-
end
|
22
|
-
|
23
|
-
WGL_FUNCTIONS_ARGS_MAP[:wglGetProcAddress] = [Fiddle::TYPE_VOIDP]
|
24
|
-
WGL_FUNCTIONS_RETVAL_MAP[:wglGetProcAddress] = Fiddle::TYPE_VOIDP
|
25
|
-
|
26
|
-
def self.wglGetProcAddress(_lpszProc_)
|
27
|
-
f = GL::get_wgl_command(:wglGetProcAddress)
|
28
|
-
f.call(_lpszProc_)
|
29
|
-
end
|
30
|
-
|
31
|
-
WGL_FUNCTIONS_ARGS_MAP[:wglGetCurrentContext] = []
|
32
|
-
WGL_FUNCTIONS_RETVAL_MAP[:wglGetCurrentContext] = Fiddle::TYPE_VOIDP
|
33
|
-
|
34
|
-
def wglGetCurrentContext()
|
35
|
-
f = GL::get_wgl_command(:wglGetCurrentContext)
|
36
|
-
f.call()
|
37
|
-
end
|
38
|
-
|
39
|
-
WGL_FUNCTIONS_ARGS_MAP[:wglGetCurrentDC] = []
|
40
|
-
WGL_FUNCTIONS_RETVAL_MAP[:wglGetCurrentDC] = Fiddle::TYPE_VOIDP
|
41
|
-
|
42
|
-
def wglGetCurrentDC()
|
43
|
-
f = GL::get_wgl_command(:wglGetCurrentDC)
|
44
|
-
f.call()
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
48
|
-
|
49
|
-
=begin
|
50
|
-
Ruby-OpenGL : Yet another OpenGL wrapper for Ruby (and wrapper code generator)
|
51
|
-
Copyright (c) 2013-2025 vaiorabbit <http://twitter.com/vaiorabbit>
|
52
|
-
|
53
|
-
This software is provided 'as-is', without any express or implied
|
54
|
-
warranty. In no event will the authors be held liable for any damages
|
55
|
-
arising from the use of this software.
|
56
|
-
|
57
|
-
Permission is granted to anyone to use this software for any purpose,
|
58
|
-
including commercial applications, and to alter it and redistribute it
|
59
|
-
freely, subject to the following restrictions:
|
60
|
-
|
61
|
-
1. The origin of this software must not be misrepresented; you must not
|
62
|
-
claim that you wrote the original software. If you use this software
|
63
|
-
in a product, an acknowledgment in the product documentation would be
|
64
|
-
appreciated but is not required.
|
65
|
-
|
66
|
-
2. Altered source versions must be plainly marked as such, and must not be
|
67
|
-
misrepresented as being the original software.
|
68
|
-
|
69
|
-
3. This notice may not be removed or altered from any source
|
70
|
-
distribution.
|
71
|
-
=end
|
1
|
+
require 'fiddle'
|
2
|
+
|
3
|
+
module GL
|
4
|
+
|
5
|
+
WGL_FUNCTIONS_MAP = {}
|
6
|
+
WGL_FUNCTIONS_ARGS_MAP = {}
|
7
|
+
WGL_FUNCTIONS_RETVAL_MAP = {}
|
8
|
+
|
9
|
+
def self.get_wgl_command(sym)
|
10
|
+
if WGL_FUNCTIONS_MAP[sym] == nil
|
11
|
+
bind_wgl_command(sym)
|
12
|
+
end
|
13
|
+
return WGL_FUNCTIONS_MAP[sym]
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.bind_wgl_command(sym)
|
17
|
+
WGL_FUNCTIONS_MAP[sym] = Fiddle::Function.new(@@gl_dll[sym.to_s],
|
18
|
+
WGL_FUNCTIONS_ARGS_MAP[sym],
|
19
|
+
WGL_FUNCTIONS_RETVAL_MAP[sym])
|
20
|
+
raise RuntimeError if WGL_FUNCTIONS_RETVAL_MAP[sym] == nil
|
21
|
+
end
|
22
|
+
|
23
|
+
WGL_FUNCTIONS_ARGS_MAP[:wglGetProcAddress] = [Fiddle::TYPE_VOIDP]
|
24
|
+
WGL_FUNCTIONS_RETVAL_MAP[:wglGetProcAddress] = Fiddle::TYPE_VOIDP
|
25
|
+
|
26
|
+
def self.wglGetProcAddress(_lpszProc_)
|
27
|
+
f = GL::get_wgl_command(:wglGetProcAddress)
|
28
|
+
f.call(_lpszProc_)
|
29
|
+
end
|
30
|
+
|
31
|
+
WGL_FUNCTIONS_ARGS_MAP[:wglGetCurrentContext] = []
|
32
|
+
WGL_FUNCTIONS_RETVAL_MAP[:wglGetCurrentContext] = Fiddle::TYPE_VOIDP
|
33
|
+
|
34
|
+
def wglGetCurrentContext()
|
35
|
+
f = GL::get_wgl_command(:wglGetCurrentContext)
|
36
|
+
f.call()
|
37
|
+
end
|
38
|
+
|
39
|
+
WGL_FUNCTIONS_ARGS_MAP[:wglGetCurrentDC] = []
|
40
|
+
WGL_FUNCTIONS_RETVAL_MAP[:wglGetCurrentDC] = Fiddle::TYPE_VOIDP
|
41
|
+
|
42
|
+
def wglGetCurrentDC()
|
43
|
+
f = GL::get_wgl_command(:wglGetCurrentDC)
|
44
|
+
f.call()
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
=begin
|
50
|
+
Ruby-OpenGL : Yet another OpenGL wrapper for Ruby (and wrapper code generator)
|
51
|
+
Copyright (c) 2013-2025 vaiorabbit <http://twitter.com/vaiorabbit>
|
52
|
+
|
53
|
+
This software is provided 'as-is', without any express or implied
|
54
|
+
warranty. In no event will the authors be held liable for any damages
|
55
|
+
arising from the use of this software.
|
56
|
+
|
57
|
+
Permission is granted to anyone to use this software for any purpose,
|
58
|
+
including commercial applications, and to alter it and redistribute it
|
59
|
+
freely, subject to the following restrictions:
|
60
|
+
|
61
|
+
1. The origin of this software must not be misrepresented; you must not
|
62
|
+
claim that you wrote the original software. If you use this software
|
63
|
+
in a product, an acknowledgment in the product documentation would be
|
64
|
+
appreciated but is not required.
|
65
|
+
|
66
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
67
|
+
misrepresented as being the original software.
|
68
|
+
|
69
|
+
3. This notice may not be removed or altered from any source
|
70
|
+
distribution.
|
71
|
+
=end
|
data/sample/README.md
CHANGED
@@ -1,55 +1,55 @@
|
|
1
|
-
For more samples, visit https://github.com/vaiorabbit/ruby-opengl/tree/master/sample .
|
2
|
-
|
3
|
-
## Getting GLFW (http://www.glfw.org) ##
|
4
|
-
|
5
|
-
* Windows
|
6
|
-
* Put glfw3.dll here. You can download pre-compiled binaries via:
|
7
|
-
* http://www.glfw.org/download.html
|
8
|
-
* If you have RubyInstaller2 with DevKit(MSYS2 gcc & make) and CMake, you can use glfw_build.bat:
|
9
|
-
* > ./glfw_build.bat
|
10
|
-
|
11
|
-
* Mac OS X
|
12
|
-
* Run ./glfw_build.sh to get ./libglfw.dylib.
|
13
|
-
|
14
|
-
## Getting GLUT ##
|
15
|
-
|
16
|
-
* Windows
|
17
|
-
* Use freeglut (http://freeglut.sourceforge.net).
|
18
|
-
* See https://sourceforge.net/p/freeglut/code/HEAD/tree/trunk/freeglut/freeglut/COPYING for copyright information
|
19
|
-
* Put freeglut.dll here.
|
20
|
-
* Windows pre-compiled binaries:
|
21
|
-
* http://www.transmissionzero.co.uk/software/freeglut-devel/
|
22
|
-
|
23
|
-
* Mac OS X
|
24
|
-
* glut.rb refers /System/Library/Frameworks/GLUT.framework by default.
|
25
|
-
* If you want to use other GLUT dll, specify the dll path and file name
|
26
|
-
via the arguments of 'GLUT.load_dll'.
|
27
|
-
* See util/setup_dll.rb for example.
|
28
|
-
* https://github.com/vaiorabbit/ruby-opengl/blob/master/sample/util/setup_dll.rb
|
29
|
-
|
30
|
-
-------------------------------------------------------------------------------
|
31
|
-
|
32
|
-
## GLFWのセットアップ (http://www.glfw.org) ##
|
33
|
-
|
34
|
-
* Windows
|
35
|
-
* glfw3.dll をここに配置してください。コンパイル済みバイナリはこちら:
|
36
|
-
* http://www.glfw.org/download.html
|
37
|
-
* RubyInstaller2 とその DevKit(MSYS2 gcc & make)、さらに CMake もインストールしている場合は glfw_build.bat も使えます:
|
38
|
-
* > ./glfw_build.bat
|
39
|
-
|
40
|
-
* Mac OS X
|
41
|
-
* ./glfw_build.sh を実行すると ./libglfw.dylib ができあがります。
|
42
|
-
|
43
|
-
## GLUTのセットアップ ##
|
44
|
-
|
45
|
-
* Windows
|
46
|
-
* freeglut を使ってください (http://freeglut.sourceforge.net).
|
47
|
-
* freeglut.dll をここに配置してください。
|
48
|
-
* コンパイル済みバイナリはこちら:
|
49
|
-
* http://www.transmissionzero.co.uk/software/freeglut-devel/
|
50
|
-
|
51
|
-
* Mac OS X
|
52
|
-
* glut.rb はデフォルトで /System/Library/Frameworks/GLUT.framework を使います。
|
53
|
-
* もしこれとは別のGLUTを使いたい場合は 'GLUT.load_dll' の引数で指定してください。
|
54
|
-
* util/setup_dll.rb が使用例となっています。
|
55
|
-
* https://github.com/vaiorabbit/ruby-opengl/blob/master/sample/util/setup_dll.rb
|
1
|
+
For more samples, visit https://github.com/vaiorabbit/ruby-opengl/tree/master/sample .
|
2
|
+
|
3
|
+
## Getting GLFW (http://www.glfw.org) ##
|
4
|
+
|
5
|
+
* Windows
|
6
|
+
* Put glfw3.dll here. You can download pre-compiled binaries via:
|
7
|
+
* http://www.glfw.org/download.html
|
8
|
+
* If you have RubyInstaller2 with DevKit(MSYS2 gcc & make) and CMake, you can use glfw_build.bat:
|
9
|
+
* > ./glfw_build.bat
|
10
|
+
|
11
|
+
* Mac OS X
|
12
|
+
* Run ./glfw_build.sh to get ./libglfw.dylib.
|
13
|
+
|
14
|
+
## Getting GLUT ##
|
15
|
+
|
16
|
+
* Windows
|
17
|
+
* Use freeglut (http://freeglut.sourceforge.net).
|
18
|
+
* See https://sourceforge.net/p/freeglut/code/HEAD/tree/trunk/freeglut/freeglut/COPYING for copyright information
|
19
|
+
* Put freeglut.dll here.
|
20
|
+
* Windows pre-compiled binaries:
|
21
|
+
* http://www.transmissionzero.co.uk/software/freeglut-devel/
|
22
|
+
|
23
|
+
* Mac OS X
|
24
|
+
* glut.rb refers /System/Library/Frameworks/GLUT.framework by default.
|
25
|
+
* If you want to use other GLUT dll, specify the dll path and file name
|
26
|
+
via the arguments of 'GLUT.load_dll'.
|
27
|
+
* See util/setup_dll.rb for example.
|
28
|
+
* https://github.com/vaiorabbit/ruby-opengl/blob/master/sample/util/setup_dll.rb
|
29
|
+
|
30
|
+
-------------------------------------------------------------------------------
|
31
|
+
|
32
|
+
## GLFWのセットアップ (http://www.glfw.org) ##
|
33
|
+
|
34
|
+
* Windows
|
35
|
+
* glfw3.dll をここに配置してください。コンパイル済みバイナリはこちら:
|
36
|
+
* http://www.glfw.org/download.html
|
37
|
+
* RubyInstaller2 とその DevKit(MSYS2 gcc & make)、さらに CMake もインストールしている場合は glfw_build.bat も使えます:
|
38
|
+
* > ./glfw_build.bat
|
39
|
+
|
40
|
+
* Mac OS X
|
41
|
+
* ./glfw_build.sh を実行すると ./libglfw.dylib ができあがります。
|
42
|
+
|
43
|
+
## GLUTのセットアップ ##
|
44
|
+
|
45
|
+
* Windows
|
46
|
+
* freeglut を使ってください (http://freeglut.sourceforge.net).
|
47
|
+
* freeglut.dll をここに配置してください。
|
48
|
+
* コンパイル済みバイナリはこちら:
|
49
|
+
* http://www.transmissionzero.co.uk/software/freeglut-devel/
|
50
|
+
|
51
|
+
* Mac OS X
|
52
|
+
* glut.rb はデフォルトで /System/Library/Frameworks/GLUT.framework を使います。
|
53
|
+
* もしこれとは別のGLUTを使いたい場合は 'GLUT.load_dll' の引数で指定してください。
|
54
|
+
* util/setup_dll.rb が使用例となっています。
|
55
|
+
* https://github.com/vaiorabbit/ruby-opengl/blob/master/sample/util/setup_dll.rb
|
data/sample/glfw_get.bat
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
@echo off
|
2
|
-
setlocal EnableDelayedExpansion
|
3
|
-
|
4
|
-
curl -O -L https://github.com/glfw/glfw/releases/download/3.3.9/glfw-3.3.9.bin.WIN64.zip
|
5
|
-
%WINDIR%\System32\tar.exe -xf glfw-3.3.9.bin.WIN64.zip
|
6
|
-
xcopy /Y glfw-3.3.9.bin.WIN64\lib-mingw-w64\glfw3.dll .
|
1
|
+
@echo off
|
2
|
+
setlocal EnableDelayedExpansion
|
3
|
+
|
4
|
+
curl -O -L https://github.com/glfw/glfw/releases/download/3.3.9/glfw-3.3.9.bin.WIN64.zip
|
5
|
+
%WINDIR%\System32\tar.exe -xf glfw-3.3.9.bin.WIN64.zip
|
6
|
+
xcopy /Y glfw-3.3.9.bin.WIN64\lib-mingw-w64\glfw3.dll .
|
data/sample/glfw_get.sh
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
curl -O -L https://github.com/glfw/glfw/releases/download/3.3.9/glfw-3.3.9.bin.MACOS.zip
|
2
|
-
tar -xf glfw-3.3.9.bin.MACOS.zip
|
3
|
-
cp glfw-3.3.9.bin.MACOS/lib-universal/libglfw.3.dylib ./libglfw.dylib
|
1
|
+
curl -O -L https://github.com/glfw/glfw/releases/download/3.3.9/glfw-3.3.9.bin.MACOS.zip
|
2
|
+
tar -xf glfw-3.3.9.bin.MACOS.zip
|
3
|
+
cp glfw-3.3.9.bin.MACOS/lib-universal/libglfw.3.dylib ./libglfw.dylib
|