opengl3 0.0.1.pre2 → 0.0.1.pre3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +21 -16
- data/Rakefile +8 -4
- data/lib/glut.rb +1 -6
- data/lib/opengl/platform/base.rb +0 -10
- data/lib/opengl/type.rb +18 -17
- data/lib/opengl/{platform/types → type}/default.yml +1 -0
- data/lib/opengl/type/i386-linux.yml +2 -0
- data/lib/opengl/type/i386-windows.yml +1 -0
- data/lib/opengl/{platform/types/darwin.yml → type/x86_64-darwin.yml} +0 -0
- data/lib/opengl/type/x86_64-linux.yml +2 -0
- data/lib/opengl/type/x86_64-windows.yml +2 -0
- data/lib/opengl/version.rb +1 -1
- data/opengl.gemspec +1 -1
- metadata +10 -7
- data/lib/opengl/platform/types/linux.yml +0 -2
data/README.md
CHANGED
@@ -6,9 +6,13 @@ OpenGL wrapper library for Ruby
|
|
6
6
|
* OpenGL 2.1 ~ 4.2
|
7
7
|
* automatic error checking each function call
|
8
8
|
* Ruby-style wrapper (not complete)
|
9
|
-
* Works on OS X 10.8 and Linux
|
10
9
|
* Inspired by PyOpenGL
|
11
10
|
|
11
|
+
Tested on
|
12
|
+
|
13
|
+
* Mac OS X 10.8 (MRI 1.9.3, Rubinius)
|
14
|
+
* Linux (MRI 1.9.3, JRuby 1.7)
|
15
|
+
|
12
16
|
## Notice
|
13
17
|
|
14
18
|
Since the project is not complete, many functions are still C-style.
|
@@ -21,15 +25,16 @@ with C-style OpenGL entrypoints.
|
|
21
25
|
Please take a look at `lib/opengl/wrapper/**/*.rb`
|
22
26
|
to see if entrypoints are wrapped.
|
23
27
|
|
24
|
-
* glGetString() -> String
|
25
|
-
* glGen__Objects__(count) -> Array
|
26
|
-
* glDelete__Objects__(Array
|
27
|
-
* glGet__Value__fv(\*args, count) -> Array
|
28
|
-
* glGet__Value__iv(\*args, count) -> Array
|
29
|
-
* glGet__Value__uiv(\*args, count) -> Array
|
30
|
-
* glShaderSource(shader, Array
|
31
|
-
* glGetShaderInfoLog(shader)
|
32
|
-
*
|
28
|
+
* glGetString(pname) -> String
|
29
|
+
* glGen__Objects__(count) -> Array<Integer>
|
30
|
+
* glDelete__Objects__(Array<Integer>) -> nil
|
31
|
+
* glGet__Value__fv(\*args, count) -> Array<Float>
|
32
|
+
* glGet__Value__iv(\*args, count) -> Array<Integer>
|
33
|
+
* glGet__Value__uiv(\*args, count) -> Array<Integer>
|
34
|
+
* glShaderSource(shader, Array<String>) -> nil
|
35
|
+
* glGetShaderInfoLog(shader) -> String
|
36
|
+
* glGetProgramInfoLog(program) -> String
|
37
|
+
* More Ruby-style functions coming soon
|
33
38
|
|
34
39
|
block-style glMapBuffer / glMapBufferRange:
|
35
40
|
|
@@ -41,12 +46,12 @@ end
|
|
41
46
|
|
42
47
|
And helper functions
|
43
48
|
|
44
|
-
* glGetVersion() -> Array
|
45
|
-
* glGetShadingLanguageVersion() -> Array
|
46
|
-
* glGetAvailableExtensions() -> Array
|
47
|
-
* glIsShaderCompiled?(shader) ->
|
48
|
-
* glIsProgramLinked?(program) ->
|
49
|
-
* More
|
49
|
+
* glGetVersion() -> Array<Integer>
|
50
|
+
* glGetShadingLanguageVersion() -> Array<Integer>
|
51
|
+
* glGetAvailableExtensions() -> Array<String>
|
52
|
+
* glIsShaderCompiled?(shader) -> Boolean
|
53
|
+
* glIsProgramLinked?(program) -> Boolean
|
54
|
+
* More helper functions coming soon
|
50
55
|
|
51
56
|
## Installation
|
52
57
|
|
data/Rakefile
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require "rake/testtask"
|
3
|
-
require "yard"
|
4
3
|
|
5
4
|
Rake::TestTask.new :spec do |t|
|
6
5
|
t.libs << "spec"
|
@@ -17,6 +16,11 @@ task :console do
|
|
17
16
|
sh "irb -rubygems -I lib -r opengl"
|
18
17
|
end
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
begin
|
20
|
+
require "yard"
|
21
|
+
rescue LoadError => e
|
22
|
+
else
|
23
|
+
YARD::Rake::YardocTask.new
|
24
|
+
desc "Generate documentation"
|
25
|
+
task(:doc => :yard)
|
26
|
+
end
|
data/lib/glut.rb
CHANGED
@@ -41,12 +41,7 @@ module GLUT
|
|
41
41
|
|
42
42
|
def glutInit
|
43
43
|
argc = FFI::MemoryPointer.new(:int, 1).write_int(0)
|
44
|
-
argv = FFI::MemoryPointer.new(:pointer, 1)
|
45
|
-
if RUBY_ENGINE == 'rbx'
|
46
|
-
argv.write_pointer(FFI::MemoryPointer::NULL)
|
47
|
-
else
|
48
|
-
argv.write_pointer(nil)
|
49
|
-
end
|
44
|
+
argv = FFI::MemoryPointer.new(:pointer, 1).write_pointer(nil)
|
50
45
|
raw_glutInit(argc, argv)
|
51
46
|
end
|
52
47
|
|
data/lib/opengl/platform/base.rb
CHANGED
@@ -4,16 +4,6 @@ require 'yaml'
|
|
4
4
|
module OpenGL::Platform
|
5
5
|
module Base
|
6
6
|
|
7
|
-
def primitive_types
|
8
|
-
@primitive_types ||= begin
|
9
|
-
root = File.expand_path('../types', __FILE__)
|
10
|
-
table = YAML.load(File.read(File.join(root, 'default.yml')))
|
11
|
-
path = File.join(root, "#{FFI::Platform::OS}.yml")
|
12
|
-
table.merge! YAML.load(File.read(path)) if File.exists? path
|
13
|
-
table.freeze
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
7
|
def calling_convention
|
18
8
|
:default
|
19
9
|
end
|
data/lib/opengl/type.rb
CHANGED
@@ -1,22 +1,29 @@
|
|
1
1
|
require 'ffi'
|
2
|
-
|
2
|
+
require 'yaml'
|
3
3
|
|
4
4
|
module OpenGL
|
5
5
|
|
6
6
|
# OpenGL Type mapper
|
7
7
|
module Type
|
8
|
+
# Root path of type definition files
|
9
|
+
ROOT = File.expand_path("../type", __FILE__)
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
|
11
|
+
default_path = File.join(ROOT, "default.yml")
|
12
|
+
platform_path = File.join(ROOT, "#{FFI::Platform::NAME}.yml")
|
13
|
+
@primitive_types = YAML.load(File.read(default_path)).merge!(
|
14
|
+
YAML.load(File.read(platform_path))
|
15
|
+
)
|
12
16
|
|
13
17
|
@type_map = Hash[
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
@primitive_types.to_a +
|
19
|
+
@primitive_types.keys.map {|t| [:"#{t}_in", :buffer_in] } +
|
20
|
+
@primitive_types.keys.map {|t| [:"#{t}_out", :buffer_out] }
|
21
|
+
].merge!({
|
22
|
+
:pointer_out => :buffer_out, :pointer_in => :buffer_in,
|
23
|
+
:void => :void, :string => :string, :pointer => :pointer,
|
24
|
+
:buffer_in => :buffer_in, :buffer_out => :buffer_out,
|
25
|
+
:GLchar_pointer_in => :buffer_in
|
26
|
+
})
|
20
27
|
|
21
28
|
# Transform the OpenGL type to native type
|
22
29
|
#
|
@@ -24,13 +31,7 @@ module OpenGL
|
|
24
31
|
# @return [Symbol] native
|
25
32
|
#
|
26
33
|
def self.find(type)
|
27
|
-
|
28
|
-
type = @type_map.fetch(type, type)
|
29
|
-
if RUBY_ENGINE == "rbx" # work around for Rubinius
|
30
|
-
[:buffer_in, :buffer_out].include?(type) ? :pointer : type
|
31
|
-
else
|
32
|
-
type
|
33
|
-
end
|
34
|
+
return @type_map.fetch(type.to_sym)
|
34
35
|
end
|
35
36
|
|
36
37
|
# @private
|
@@ -0,0 +1 @@
|
|
1
|
+
{}
|
File without changes
|
data/lib/opengl/version.rb
CHANGED
data/opengl.gemspec
CHANGED
@@ -20,5 +20,5 @@ Gem::Specification.new do |gem|
|
|
20
20
|
gem.required_ruby_version = ">= 1.9"
|
21
21
|
gem.add_dependency "ffi", ">= 1.2.0"
|
22
22
|
gem.add_development_dependency "rake", "~> 10.0.0"
|
23
|
-
gem.add_development_dependency "minitest", "
|
23
|
+
gem.add_development_dependency "minitest", ">= 4.3.0"
|
24
24
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opengl3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.
|
4
|
+
version: 0.0.1.pre3
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|
@@ -48,7 +48,7 @@ dependencies:
|
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
none: false
|
50
50
|
requirements:
|
51
|
-
- -
|
51
|
+
- - ! '>='
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: 4.3.0
|
54
54
|
type: :development
|
@@ -56,7 +56,7 @@ dependencies:
|
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
none: false
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 4.3.0
|
62
62
|
description: An OpenGL wrapper library for Ruby (OpenGL 2.1-4.2)
|
@@ -158,9 +158,6 @@ files:
|
|
158
158
|
- lib/opengl/platform/base.rb
|
159
159
|
- lib/opengl/platform/darwin.rb
|
160
160
|
- lib/opengl/platform/linux.rb
|
161
|
-
- lib/opengl/platform/types/darwin.yml
|
162
|
-
- lib/opengl/platform/types/default.yml
|
163
|
-
- lib/opengl/platform/types/linux.yml
|
164
161
|
- lib/opengl/raw.rb
|
165
162
|
- lib/opengl/raw/core/2_x/GL_VERSION_1_0.yml
|
166
163
|
- lib/opengl/raw/core/2_x/GL_VERSION_1_1.yml
|
@@ -208,6 +205,12 @@ files:
|
|
208
205
|
- lib/opengl/raw/core/4_2/GL_ARB_transform_feedback_instanced.yml
|
209
206
|
- lib/opengl/raw/core/4_2/GL_VERSION_4_2.yml
|
210
207
|
- lib/opengl/type.rb
|
208
|
+
- lib/opengl/type/default.yml
|
209
|
+
- lib/opengl/type/i386-linux.yml
|
210
|
+
- lib/opengl/type/i386-windows.yml
|
211
|
+
- lib/opengl/type/x86_64-darwin.yml
|
212
|
+
- lib/opengl/type/x86_64-linux.yml
|
213
|
+
- lib/opengl/type/x86_64-windows.yml
|
211
214
|
- lib/opengl/version.rb
|
212
215
|
- lib/opengl/wrapper.rb
|
213
216
|
- lib/opengl/wrapper/base.rb
|