Class: Roglew::Buffer
- Inherits:
-
Object
- Object
- Roglew::Buffer
- Defined in:
- lib/roglew/extensions/GL_VERSION_1_5/buffer.rb
Instance Attribute Summary collapse
-
#handle ⇒ Object
readonly
Returns the value of attribute handle.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Class Method Summary collapse
Instance Method Summary collapse
- #bind(target, deferred = nil, &block) ⇒ Object
-
#initialize(handle) ⇒ Buffer
constructor
A new instance of Buffer.
Constructor Details
#initialize(handle) ⇒ Buffer
Returns a new instance of Buffer.
7 8 9 10 11 12 |
# File 'lib/roglew/extensions/GL_VERSION_1_5/buffer.rb', line 7 def initialize(handle) @handle = handle @id = handle.bind { |context| context.gen_buffers } ObjectSpace.define_finalizer(self, self.class.finalize(@handle, @id)) end |
Instance Attribute Details
#handle ⇒ Object (readonly)
Returns the value of attribute handle.
5 6 7 |
# File 'lib/roglew/extensions/GL_VERSION_1_5/buffer.rb', line 5 def handle @handle end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/roglew/extensions/GL_VERSION_1_5/buffer.rb', line 5 def id @id end |
Class Method Details
.finalize(handle, id) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/roglew/extensions/GL_VERSION_1_5/buffer.rb', line 14 def self.finalize(handle, id) proc do #puts "releasing buffer #{id}" handle.bind { |context| context.delete_buffers(id) } end end |
Instance Method Details
#bind(target, deferred = nil, &block) ⇒ Object
21 22 23 |
# File 'lib/roglew/extensions/GL_VERSION_1_5/buffer.rb', line 21 def bind(target, deferred = nil, &block) create_binding(deferred, target, &block) end |