Class: Roglew::RenderbufferARB

Inherits:
Object
  • Object
show all
Defined in:
lib/roglew/extensions/GL_ARB_framebuffer_object/renderbuffer.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(handle) ⇒ RenderbufferARB

Returns a new instance of RenderbufferARB.



7
8
9
10
11
# File 'lib/roglew/extensions/GL_ARB_framebuffer_object/renderbuffer.rb', line 7

def initialize(handle)
  @handle = handle
  @id = handle.bind { |context| context.gen_renderbuffers }
  ObjectSpace.define_finalizer(self, self.class.finalize(@handle, @id))
end

Instance Attribute Details

#handleObject (readonly)

Returns the value of attribute handle.



5
6
7
# File 'lib/roglew/extensions/GL_ARB_framebuffer_object/renderbuffer.rb', line 5

def handle
  @handle
end

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/roglew/extensions/GL_ARB_framebuffer_object/renderbuffer.rb', line 5

def id
  @id
end

Class Method Details

.finalize(handle, id) ⇒ Object



13
14
15
16
17
18
# File 'lib/roglew/extensions/GL_ARB_framebuffer_object/renderbuffer.rb', line 13

def self.finalize(handle, id)
  proc do
    #puts "releasing renderbuffer #{id}"
    handle.bind { |context| context.delete_renderbuffers(id) }
  end
end

Instance Method Details

#bind(deferred = nil, &block) ⇒ Object



20
21
22
# File 'lib/roglew/extensions/GL_ARB_framebuffer_object/renderbuffer.rb', line 20

def bind(deferred = nil, &block)
  create_binding(deferred, &block)
end