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.
@@ -1,52 +1,52 @@
1
- module OpenGL
2
-
3
- def self.check_extension( ext_name )
4
- glGetString = OpenGL.get_command(:glGetString) # [INTERNAL] Shortcut to get pointer without proper user setup.
5
- version_number = glGetString.call(GL_VERSION).to_s.split(/\./)
6
- if version_number[0].to_i >= 3
7
- # glGetString(GL_EXTENSIONS) was deprecated in OpenGL 3.0
8
- # Ref.: http://sourceforge.net/p/glew/bugs/120/
9
- glGetIntegerv = OpenGL.get_command(:glGetIntegerv)
10
- glGetStringi = OpenGL.get_command(:glGetStringi)
11
- extensions_count_buf = ' '
12
- glGetIntegerv.call( GL_NUM_EXTENSIONS, extensions_count_buf )
13
- extensions_count = extensions_count_buf.unpack('L')[0]
14
- extensions_count.times do |i|
15
- supported_ext_name = glGetStringi.call( GL_EXTENSIONS, i ).to_s
16
- return true if ext_name == supported_ext_name
17
- end
18
- return false
19
- else
20
- ext_strings = glGetString.call(GL_EXTENSIONS).to_s.split(/ /)
21
- return ext_strings.include? ext_name
22
- end
23
- end
24
-
25
- def self.setup_extension( ext_name, skip_check: false )
26
- if skip_check || self.check_extension( ext_name )
27
- define_ext_enum = "define_ext_enum_#{ext_name}".to_sym
28
- define_ext_command = "define_ext_command_#{ext_name}".to_sym
29
- OpenGLExt.send( define_ext_enum )
30
- OpenGLExt.send( define_ext_command )
31
- end
32
- end
33
-
34
- def self.setup_extension_all( skip_check: false )
35
- self.methods.each do |method_name|
36
- if method_name =~ /define_ext_command_(.*)/
37
- setup_extension( $1, skip_check )
38
- end
39
- end
40
- end
41
-
42
- def self.get_extension_enum_symbols( ext_name )
43
- get_ext_enum = "get_ext_enum_#{ext_name}".to_sym
44
- OpenGLExt.send( get_ext_enum )
45
- end
46
-
47
- def self.get_extension_command_symbols( ext_name )
48
- get_ext_command = "get_ext_command_#{ext_name}".to_sym
49
- OpenGLExt.send( get_ext_command )
50
- end
51
-
52
- end
1
+ module OpenGL
2
+
3
+ def self.check_extension( ext_name )
4
+ glGetString = OpenGL.get_command(:glGetString) # [INTERNAL] Shortcut to get pointer without proper user setup.
5
+ version_number = glGetString.call(GL_VERSION).to_s.split(/\./)
6
+ if version_number[0].to_i >= 3
7
+ # glGetString(GL_EXTENSIONS) was deprecated in OpenGL 3.0
8
+ # Ref.: http://sourceforge.net/p/glew/bugs/120/
9
+ glGetIntegerv = OpenGL.get_command(:glGetIntegerv)
10
+ glGetStringi = OpenGL.get_command(:glGetStringi)
11
+ extensions_count_buf = ' '
12
+ glGetIntegerv.call( GL_NUM_EXTENSIONS, extensions_count_buf )
13
+ extensions_count = extensions_count_buf.unpack('L')[0]
14
+ extensions_count.times do |i|
15
+ supported_ext_name = glGetStringi.call( GL_EXTENSIONS, i ).to_s
16
+ return true if ext_name == supported_ext_name
17
+ end
18
+ return false
19
+ else
20
+ ext_strings = glGetString.call(GL_EXTENSIONS).to_s.split(/ /)
21
+ return ext_strings.include? ext_name
22
+ end
23
+ end
24
+
25
+ def self.setup_extension( ext_name, skip_check: false )
26
+ if skip_check || self.check_extension( ext_name )
27
+ define_ext_enum = "define_ext_enum_#{ext_name}".to_sym
28
+ define_ext_command = "define_ext_command_#{ext_name}".to_sym
29
+ OpenGLExt.send( define_ext_enum )
30
+ OpenGLExt.send( define_ext_command )
31
+ end
32
+ end
33
+
34
+ def self.setup_extension_all( skip_check: false )
35
+ self.methods.each do |method_name|
36
+ if method_name =~ /define_ext_command_(.*)/
37
+ setup_extension( $1, skip_check )
38
+ end
39
+ end
40
+ end
41
+
42
+ def self.get_extension_enum_symbols( ext_name )
43
+ get_ext_enum = "get_ext_enum_#{ext_name}".to_sym
44
+ OpenGLExt.send( get_ext_enum )
45
+ end
46
+
47
+ def self.get_extension_command_symbols( ext_name )
48
+ get_ext_command = "get_ext_command_#{ext_name}".to_sym
49
+ OpenGLExt.send( get_ext_command )
50
+ end
51
+
52
+ end