Class: Roglew::Query

Inherits:
Object
  • Object
show all
Defined in:
lib/roglew/extensions/GL_VERSION_1_5/query.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(handle) ⇒ Query

Returns a new instance of Query.



6
7
8
9
10
# File 'lib/roglew/extensions/GL_VERSION_1_5/query.rb', line 6

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

Instance Attribute Details

#handleObject (readonly)

Returns the value of attribute handle.



4
5
6
# File 'lib/roglew/extensions/GL_VERSION_1_5/query.rb', line 4

def handle
  @handle
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/roglew/extensions/GL_VERSION_1_5/query.rb', line 4

def id
  @id
end

Class Method Details

.finalize(handle, id) ⇒ Object



12
13
14
15
16
17
# File 'lib/roglew/extensions/GL_VERSION_1_5/query.rb', line 12

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