Class: Roglew::FramebufferEXT

Inherits:
Object
  • Object
show all
Defined in:
lib/roglew/extensions/GL_EXT_framebuffer_object/framebuffer.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(handle) ⇒ FramebufferEXT

Returns a new instance of FramebufferEXT.



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

def initialize(handle)
  @handle = handle
  @id = handle.bind { |context| context.gen_framebuffersEXT }
  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_EXT_framebuffer_object/framebuffer.rb', line 5

def handle
  @handle
end

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/roglew/extensions/GL_EXT_framebuffer_object/framebuffer.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_EXT_framebuffer_object/framebuffer.rb', line 13

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

Instance Method Details

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

target: one of GL::DRAW_FRAMEBUFFER_EXT, GL::READ_FRAMEBUFFER_EXT or GL::FRAMEBUFFER_EXT



21
22
23
# File 'lib/roglew/extensions/GL_EXT_framebuffer_object/framebuffer.rb', line 21

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