Class: Rugl::State::Scissor

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

Class Method Summary collapse

Class Method Details

.apply(gl:, params:) ⇒ Object



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

def apply(gl:, params:)
  state = normalize(params)

  if state[:enable]
    Util.gl_call(gl, :Enable, Util.gl_const(:SCISSOR_TEST, gl: gl))
    box = state[:box]
    Util.gl_call(gl, :Scissor, box[:x].to_i, box[:y].to_i, box[:width].to_i, box[:height].to_i)
  else
    Util.gl_call(gl, :Disable, Util.gl_const(:SCISSOR_TEST, gl: gl))
  end
end

.defaultObject



19
20
21
22
23
24
# File 'lib/rugl/state/scissor.rb', line 19

def default
  {
    enable: false,
    box: { x: 0, y: 0, width: 0, height: 0 }
  }
end