Class: Rugl::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/rugl/command.rb

Instance Method Summary collapse

Constructor Details

#initialize(context:, program:, vao:, attributes:, uniforms:, elements:, state:, draw_params:, framebuffer:) ⇒ Command

Returns a new instance of Command.



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rugl/command.rb', line 5

def initialize(context:, program:, vao:, attributes:, uniforms:, elements:, state:, draw_params:, framebuffer:)
  @context = context
  @program = program
  @vao = vao
  @attributes = attributes
  @uniforms = uniforms
  @elements = elements
  @state = state
  @draw_params = draw_params
  @framebuffer = framebuffer
  @texture_unit_counter = 0
  @bound_framebuffer = nil
end

Instance Method Details

#call(props_or_array = {}, &block) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/rugl/command.rb', line 19

def call(props_or_array = {}, &block)
  if block
    execute_scoped(props_or_array || {}, &block)
  elsif props_or_array.is_a?(Array)
    execute_batch(props_or_array)
  else
    execute_single(props_or_array || {})
  end
end

#destroyObject



29
30
31
32
# File 'lib/rugl/command.rb', line 29

def destroy
  @vao&.destroy
  nil
end