roglew 0.1.1 → 0.1.3

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.
@@ -18,9 +18,9 @@ module Roglew
18
18
  nil
19
19
  end
20
20
 
21
- def run(&block)
21
+ def run
22
22
  return unless block_given?
23
- ergo &block
23
+ yield
24
24
  finished
25
25
  end
26
26
  end
@@ -9,10 +9,10 @@ module Roglew
9
9
  context.send(method, *args)
10
10
  end
11
11
 
12
- def run(&block)
12
+ def run
13
13
  bind
14
14
  return unless block_given?
15
- ergo &block
15
+ yield
16
16
  finished
17
17
  end
18
18
  end
@@ -5,7 +5,7 @@ module Roglew
5
5
  attr_reader :context, :id
6
6
 
7
7
  def initialize(context)
8
- @context = context.bind { |c| @id = c.gen_framebuffers }
8
+ @context = context.bind { @id = context.gen_framebuffers }
9
9
  self.class.finalize(self, @context, @id)
10
10
  end
11
11
 
@@ -5,7 +5,7 @@ module Roglew
5
5
  attr_reader :context, :id
6
6
 
7
7
  def initialize(context)
8
- @context = context.bind { |c| @id = c.gen_renderbuffers }
8
+ @context = context.bind { @id = context.gen_renderbuffers }
9
9
  self.class.finalize(self, @context, @id)
10
10
  end
11
11
 
@@ -0,0 +1,25 @@
1
+ module Roglew
2
+ class VertexArray
3
+
4
+ attr_reader :context, :id
5
+
6
+ def initialize(context)
7
+ @context = context.bind { @id = context.gen_vertex_arrays }
8
+ self.class.finalize(self, @context, @id)
9
+ end
10
+
11
+ def self.finalize(obj, ctx, id)
12
+ ObjectSpace.define_finalizer(obj, proc do
13
+ puts "releasing vertex array #{id}"
14
+ ctx.delete_vertex_arrays(id)
15
+ end)
16
+ end
17
+
18
+ def bind(&block)
19
+ @context.glBindVertexArray(@id)
20
+ return unless block_given?
21
+ yield &block
22
+ @context.glBindVertexArray(0)
23
+ end
24
+ end
25
+ end
@@ -5,7 +5,7 @@ module Roglew
5
5
  attr_reader :context, :id
6
6
 
7
7
  def initialize(context)
8
- @context = context.bind { |c| @id = c.gen_framebuffersEXT }
8
+ @context = context.bind { @id = context.gen_framebuffersEXT }
9
9
  self.class.finalize(self, @context, @id)
10
10
  end
11
11
 
@@ -5,7 +5,7 @@ module Roglew
5
5
  attr_reader :context, :id
6
6
 
7
7
  def initialize(context)
8
- @context = context.bind { |c| @id = c.gen_renderbuffersEXT }
8
+ @context = context.bind { @id = context.gen_renderbuffersEXT }
9
9
  self.class.finalize(self, @context, @id)
10
10
  end
11
11
 
@@ -3,13 +3,13 @@ module Roglew
3
3
  attr_reader :context, :id, :type
4
4
 
5
5
  def initialize(context, type, src = nil)
6
- @context = context.bind { |c| @id = c.glCreateShader(type) }
6
+ @context = context.bind { @id = context.glCreateShader(type) }
7
7
  @type = type
8
8
  raise OpenGLError, "couldn't create a shader of type #{type.to_s(16)}" if @id == 0
9
9
 
10
10
  if src
11
11
  src = File.read(src) if File.file? src
12
- @context.bind { |_| compile(src) }
12
+ @context.bind { compile(src) }
13
13
  end
14
14
 
15
15
  self.class.finalize(self, @id, @context)
@@ -5,7 +5,7 @@ module Roglew
5
5
  :shaders
6
6
 
7
7
  def initialize(context)
8
- @context = context.bind { |c| @id = c.glCreateProgram() }
8
+ @context = context.bind { @id = context.glCreateProgram() }
9
9
  end
10
10
 
11
11
  def attach(*shaders)
@@ -103,10 +103,10 @@ module GL_VERSION_2_0
103
103
  else
104
104
  raise ArgumentError, "It must be Hash or Array. Given: #{shaders.class}"
105
105
  end
106
- bind { |_|
106
+ bind do
107
107
  program.attach(*shaders)
108
108
  program.link
109
- }
109
+ end
110
110
  program
111
111
  end
112
112
 
@@ -60,10 +60,10 @@ module Roglew
60
60
  singleton_class.send(:include, mod) if mod
61
61
  end
62
62
 
63
- def bind(&block)
63
+ def bind
64
64
  wglMakeCurrent(@hdc, @hrc)
65
65
  if block_given?
66
- ergo &block
66
+ yield
67
67
  unbind
68
68
  end
69
69
  self
@@ -85,10 +85,10 @@ module Roglew
85
85
 
86
86
  def_object :Textures
87
87
 
88
- def begin(mode, &block)
88
+ def begin(mode)
89
89
  glBegin(mode)
90
90
  return unless block_given?
91
- ergo &block
91
+ yield
92
92
  glEnd
93
93
  end
94
94
 
@@ -14,7 +14,7 @@ module Roglew
14
14
  ctx = @context_class.new(self, deferred)
15
15
  GL.make_current(@hdc, @hrc) unless deferred
16
16
  return ctx unless block_given?
17
- ctx.ergo &block
17
+ yield
18
18
  if deferred then ctx.apply else self.class.unbind end
19
19
 
20
20
  self
data/lib/roglew.rb CHANGED
@@ -1,14 +1,13 @@
1
1
  #Raw Glue - the Ruby OpenGL and Extensions Wrapper
2
2
 
3
3
  module Roglew
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.3'
5
5
  end
6
6
 
7
7
  #external dependencies
8
8
  %w'
9
9
  set
10
10
  ffi
11
- facets/kernel/ergo
12
11
  facets/module/module_load
13
12
  facets/string/camelcase
14
13
  facets/string/snakecase
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roglew
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,55 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
  date: 2012-11-10 00:00:00.000000000 Z
14
- dependencies: []
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: ducktape
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 0.3.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: 0.3.0
31
+ - !ruby/object:Gem::Dependency
32
+ name: facets
33
+ requirement: !ruby/object:Gem::Requirement
34
+ none: false
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: 2.9.3
39
+ type: :runtime
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: 2.9.3
47
+ - !ruby/object:Gem::Dependency
48
+ name: ffi
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 1.1.5
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: 1.1.5
15
63
  description: A gem to wrap OpenGL and extensions in an intuitive OO framework.
16
64
  email:
17
65
  - silver.phoenix99@gmail.com
@@ -158,6 +206,7 @@ files:
158
206
  - lib/roglew/extensions/GL_ARB_transpose_matrix.rb
159
207
  - lib/roglew/extensions/GL_ARB_uniform_buffer_object.rb
160
208
  - lib/roglew/extensions/GL_ARB_vertex_array_bgra.rb
209
+ - lib/roglew/extensions/GL_ARB_vertex_array_object/vertex_array.rb
161
210
  - lib/roglew/extensions/GL_ARB_vertex_array_object.rb
162
211
  - lib/roglew/extensions/GL_ARB_vertex_attrib_64bit.rb
163
212
  - lib/roglew/extensions/GL_ARB_vertex_attrib_binding.rb