roglew 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/roglew/contexts/deferred.rb +2 -2
- data/lib/roglew/contexts/immediate.rb +2 -2
- data/lib/roglew/extensions/GL_ARB_framebuffer_object/framebuffer.rb +1 -1
- data/lib/roglew/extensions/GL_ARB_framebuffer_object/renderbuffer.rb +1 -1
- data/lib/roglew/extensions/GL_ARB_vertex_array_object/vertex_array.rb +25 -0
- data/lib/roglew/extensions/GL_EXT_framebuffer_object/framebuffer.rb +1 -1
- data/lib/roglew/extensions/GL_EXT_framebuffer_object/renderbuffer.rb +1 -1
- data/lib/roglew/extensions/GL_VERSION_2_0/shader.rb +2 -2
- data/lib/roglew/extensions/GL_VERSION_2_0/shader_program.rb +1 -1
- data/lib/roglew/extensions/GL_VERSION_2_0.rb +2 -2
- data/lib/roglew/render_context.rb +4 -4
- data/lib/roglew/render_handle.rb +1 -1
- data/lib/roglew.rb +1 -2
- metadata +51 -2
@@ -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
|
@@ -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 {
|
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 {
|
12
|
+
@context.bind { compile(src) }
|
13
13
|
end
|
14
14
|
|
15
15
|
self.class.finalize(self, @id, @context)
|
@@ -60,10 +60,10 @@ module Roglew
|
|
60
60
|
singleton_class.send(:include, mod) if mod
|
61
61
|
end
|
62
62
|
|
63
|
-
def bind
|
63
|
+
def bind
|
64
64
|
wglMakeCurrent(@hdc, @hrc)
|
65
65
|
if block_given?
|
66
|
-
|
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
|
88
|
+
def begin(mode)
|
89
89
|
glBegin(mode)
|
90
90
|
return unless block_given?
|
91
|
-
|
91
|
+
yield
|
92
92
|
glEnd
|
93
93
|
end
|
94
94
|
|
data/lib/roglew/render_handle.rb
CHANGED
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.
|
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.
|
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
|