class Roglew::VertexArray

Attributes

handle[R]
id[R]

Public Class Methods

finalize(handle, id) click to toggle source
# File lib/roglew/extensions/GL_ARB_vertex_array_object/vertex_array.rb, line 12
def self.finalize(handle, id)
  proc do
    #puts "releasing vertex array #{id}"
    handle.bind { |rc| rc.delete_vertex_arrays(id) }
  end
end
new(handle) click to toggle source
# File lib/roglew/extensions/GL_ARB_vertex_array_object/vertex_array.rb, line 6
def initialize(handle)
  @handle = handle
  @id = handle.bind { |rc| rc.gen_vertex_arrays }
  ObjectSpace.define_finalizer(self, self.class.finalize(@handle, @id))
end

Public Instance Methods

bind() { || ... } click to toggle source
# File lib/roglew/extensions/GL_ARB_vertex_array_object/vertex_array.rb, line 19
def bind
  @handle.glBindVertexArray(@id)
  if block_given?
    yield
    @handle.glBindVertexArray(0)
  end
  self
end