opengl-core 1.0.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/opengl-core/opengl_stub.c +10 -5
- data/lib/opengl-core.rb +21 -0
- data/lib/opengl-core/aux.rb +7 -0
- data/lib/opengl-core/aux/buffer.rb +44 -0
- data/lib/opengl-core/aux/gl.rb +238 -0
- data/lib/opengl-core/aux/marked.rb +66 -0
- data/lib/opengl-core/aux/program.rb +116 -0
- data/lib/opengl-core/aux/shader.rb +49 -0
- data/lib/opengl-core/aux/texture.rb +45 -0
- data/lib/opengl-core/aux/vertex_array.rb +43 -0
- data/lib/opengl-core/gl_commands.rb +6732 -4350
- data/lib/opengl-core/gl_enums.rb +1263 -19
- data/lib/opengl-core/gl_sym.rb +30 -5
- metadata +11 -3
data/lib/opengl-core/gl_sym.rb
CHANGED
@@ -1,26 +1,51 @@
|
|
1
1
|
require 'fiddle'
|
2
2
|
require 'opengl-core/opengl_stub'
|
3
3
|
|
4
|
-
module
|
4
|
+
module Gl ; end
|
5
5
|
|
6
|
+
# @api private
|
7
|
+
module Gl::GlSym
|
8
|
+
|
9
|
+
# Filled by gl_commands.rb
|
10
|
+
GL_COMMAND_TYPES = {}
|
11
|
+
# Filled by __load_gl_sym__
|
12
|
+
GL_COMMAND_FUNCTIONS = {}
|
13
|
+
|
14
|
+
# OpenGL library handle.
|
6
15
|
@@opengl_lib = nil
|
7
16
|
|
8
|
-
|
17
|
+
# Loads a symbol from the GL library. If the GL library hasn't yet been loaded
|
18
|
+
# it will also do that. The returned function will be a wrapped Fiddle
|
19
|
+
# function using the types that function name is associated with in
|
20
|
+
# GL_COMMAND_TYPES. The returned value is cached in GL_COMMAND_FUNCTIONS and
|
21
|
+
# returned if __load_gl_sym__ is called for the same name again.
|
22
|
+
def self.__load_gl_sym__(name)
|
9
23
|
if @@opengl_lib.nil?
|
10
24
|
lib_path = case
|
11
25
|
when apple?
|
12
26
|
'/System/Library/Frameworks/OpenGL.framework/OpenGL'
|
27
|
+
when windows? || Fiddle::WINDOWS
|
28
|
+
'opengl32.dll'
|
13
29
|
when unix? || linux?
|
14
30
|
'libGL.so.1'
|
15
|
-
when windows?
|
16
|
-
'opengl32.dll'
|
17
31
|
else
|
18
32
|
raise 'Unrecognized platform'
|
19
33
|
end
|
20
34
|
@@opengl_lib = Fiddle.dlopen(lib_path)
|
21
35
|
end
|
22
36
|
|
23
|
-
|
37
|
+
fn = GL_COMMAND_FUNCTIONS[name]
|
38
|
+
if fn.nil?
|
39
|
+
fn = (GL_COMMAND_FUNCTIONS[name] = begin
|
40
|
+
sym = @@opengl_lib[name.to_s]
|
41
|
+
types = GL_COMMAND_TYPES[name]
|
42
|
+
Fiddle::Function.new(sym, types[:parameter_types], types[:return_type])
|
43
|
+
rescue
|
44
|
+
false
|
45
|
+
end)
|
46
|
+
end
|
47
|
+
|
48
|
+
fn
|
24
49
|
end
|
25
50
|
|
26
51
|
end # module GlSym
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opengl-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Noel Raymond Cower
|
@@ -25,13 +25,21 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
description: OpenGL core profile (3.2 onward, no deprecated functionality) bindings
|
28
|
-
for Ruby 2.x. Generated from
|
28
|
+
for Ruby 2.x. Generated from Khronos XML spec files.
|
29
29
|
email: ncower@gmail.com
|
30
30
|
executables: []
|
31
31
|
extensions:
|
32
32
|
- ext/opengl-core/extconf.rb
|
33
33
|
extra_rdoc_files: []
|
34
34
|
files:
|
35
|
+
- lib/opengl-core/aux/buffer.rb
|
36
|
+
- lib/opengl-core/aux/gl.rb
|
37
|
+
- lib/opengl-core/aux/marked.rb
|
38
|
+
- lib/opengl-core/aux/program.rb
|
39
|
+
- lib/opengl-core/aux/shader.rb
|
40
|
+
- lib/opengl-core/aux/texture.rb
|
41
|
+
- lib/opengl-core/aux/vertex_array.rb
|
42
|
+
- lib/opengl-core/aux.rb
|
35
43
|
- lib/opengl-core/gl_commands.rb
|
36
44
|
- lib/opengl-core/gl_enums.rb
|
37
45
|
- lib/opengl-core/gl_sym.rb
|
@@ -50,7 +58,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
50
58
|
requirements:
|
51
59
|
- - '>='
|
52
60
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
61
|
+
version: 2.0.0
|
54
62
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
63
|
requirements:
|
56
64
|
- - '>='
|