opengl-bindings 1.6.11 → 1.6.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +701 -657
- data/LICENSE.txt +1 -1
- data/README.md +676 -536
- data/lib/glfw.rb +711 -711
- data/lib/glu.rb +366 -366
- data/lib/glut.rb +576 -576
- data/lib/opengl.rb +43 -43
- data/lib/opengl_command.rb +7347 -7347
- data/lib/opengl_common.rb +54 -54
- data/lib/opengl_enum.rb +1818 -1818
- data/lib/opengl_es.rb +31 -31
- data/lib/opengl_es_command.rb +2517 -2517
- data/lib/opengl_es_ext.rb +28 -28
- data/lib/opengl_es_ext_command.rb +8498 -8377
- data/lib/opengl_es_ext_enum.rb +6212 -6055
- data/lib/opengl_ext.rb +34 -34
- data/lib/opengl_ext_command.rb +30787 -30480
- data/lib/opengl_ext_common.rb +52 -52
- data/lib/opengl_ext_enum.rb +14146 -14082
- 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/glfw_build.bat +3 -2
- data/sample/glfw_build.sh +14 -13
- metadata +9 -9
data/lib/opengl_common.rb
CHANGED
@@ -1,54 +1,54 @@
|
|
1
|
-
module OpenGL
|
2
|
-
|
3
|
-
GL_FUNCTIONS_MAP = {}
|
4
|
-
GL_FUNCTIONS_ARGS_MAP = {}
|
5
|
-
GL_FUNCTIONS_RETVAL_MAP = {}
|
6
|
-
@@gl_dll = nil
|
7
|
-
|
8
|
-
def self.load_lib(lib = nil, path = nil)
|
9
|
-
if lib == nil && path == nil
|
10
|
-
case self.get_platform
|
11
|
-
when :OPENGL_PLATFORM_WINDOWS
|
12
|
-
lib, path = 'opengl32.dll', 'C:/Windows/System32'
|
13
|
-
when :OPENGL_PLATFORM_MACOSX
|
14
|
-
lib, path = 'libGL.dylib','/System/Library/Frameworks/OpenGL.framework/Libraries'
|
15
|
-
else
|
16
|
-
lib = 'libGL.so'
|
17
|
-
end
|
18
|
-
end
|
19
|
-
if path
|
20
|
-
@@gl_dll = Fiddle.dlopen( path + '/' + lib )
|
21
|
-
else
|
22
|
-
@@gl_dll = Fiddle.dlopen( lib )
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.load_dll(lib = nil, path = nil)
|
27
|
-
puts "Warning OpenGl.load_dll is deprecated, use OpenGL.load_lib instead"
|
28
|
-
self.load_lib(lib, path)
|
29
|
-
end
|
30
|
-
|
31
|
-
def self.get_command( sym )
|
32
|
-
if GL_FUNCTIONS_MAP[sym] == nil
|
33
|
-
bind_command( sym )
|
34
|
-
end
|
35
|
-
return GL_FUNCTIONS_MAP[sym]
|
36
|
-
end
|
37
|
-
|
38
|
-
def self.bind_command( sym )
|
39
|
-
begin
|
40
|
-
GL_FUNCTIONS_MAP[sym] = Fiddle::Function.new( @@gl_dll[sym.to_s],
|
41
|
-
GL_FUNCTIONS_ARGS_MAP[sym],
|
42
|
-
GL_FUNCTIONS_RETVAL_MAP[sym] )
|
43
|
-
rescue Exception => e
|
44
|
-
if self.get_platform == :OPENGL_PLATFORM_WINDOWS
|
45
|
-
func_ptr = wglGetProcAddress(sym.to_s)
|
46
|
-
GL_FUNCTIONS_MAP[sym] = Fiddle::Function.new( func_ptr,
|
47
|
-
GL_FUNCTIONS_ARGS_MAP[sym],
|
48
|
-
GL_FUNCTIONS_RETVAL_MAP[sym] )
|
49
|
-
end
|
50
|
-
raise RuntimeError if GL_FUNCTIONS_MAP[sym] == nil
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
1
|
+
module OpenGL
|
2
|
+
|
3
|
+
GL_FUNCTIONS_MAP = {}
|
4
|
+
GL_FUNCTIONS_ARGS_MAP = {}
|
5
|
+
GL_FUNCTIONS_RETVAL_MAP = {}
|
6
|
+
@@gl_dll = nil
|
7
|
+
|
8
|
+
def self.load_lib(lib = nil, path = nil)
|
9
|
+
if lib == nil && path == nil
|
10
|
+
case self.get_platform
|
11
|
+
when :OPENGL_PLATFORM_WINDOWS
|
12
|
+
lib, path = 'opengl32.dll', 'C:/Windows/System32'
|
13
|
+
when :OPENGL_PLATFORM_MACOSX
|
14
|
+
lib, path = 'libGL.dylib','/System/Library/Frameworks/OpenGL.framework/Libraries'
|
15
|
+
else
|
16
|
+
lib = 'libGL.so'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
if path
|
20
|
+
@@gl_dll = Fiddle.dlopen( path + '/' + lib )
|
21
|
+
else
|
22
|
+
@@gl_dll = Fiddle.dlopen( lib )
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.load_dll(lib = nil, path = nil)
|
27
|
+
puts "Warning OpenGl.load_dll is deprecated, use OpenGL.load_lib instead"
|
28
|
+
self.load_lib(lib, path)
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.get_command( sym )
|
32
|
+
if GL_FUNCTIONS_MAP[sym] == nil
|
33
|
+
bind_command( sym )
|
34
|
+
end
|
35
|
+
return GL_FUNCTIONS_MAP[sym]
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.bind_command( sym )
|
39
|
+
begin
|
40
|
+
GL_FUNCTIONS_MAP[sym] = Fiddle::Function.new( @@gl_dll[sym.to_s],
|
41
|
+
GL_FUNCTIONS_ARGS_MAP[sym],
|
42
|
+
GL_FUNCTIONS_RETVAL_MAP[sym] )
|
43
|
+
rescue Exception => e
|
44
|
+
if self.get_platform == :OPENGL_PLATFORM_WINDOWS
|
45
|
+
func_ptr = wglGetProcAddress(sym.to_s)
|
46
|
+
GL_FUNCTIONS_MAP[sym] = Fiddle::Function.new( func_ptr,
|
47
|
+
GL_FUNCTIONS_ARGS_MAP[sym],
|
48
|
+
GL_FUNCTIONS_RETVAL_MAP[sym] )
|
49
|
+
end
|
50
|
+
raise RuntimeError if GL_FUNCTIONS_MAP[sym] == nil
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|