Class: Mittsu::OpenGLDefaultTarget

Inherits:
Object
  • Object
show all
Defined in:
lib/mittsu/renderers/opengl/opengl_default_target.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(renderer) ⇒ OpenGLDefaultTarget

Returns a new instance of OpenGLDefaultTarget.



7
8
9
10
11
12
13
# File 'lib/mittsu/renderers/opengl/opengl_default_target.rb', line 7

def initialize renderer
  @renderer = renderer
  @viewport_width = 0
  @viewport_height = 0
  @viewport_x = 0
  @viewport_y = 0
end

Instance Attribute Details

#viewport_heightObject Also known as: height

Returns the value of attribute viewport_height.



3
4
5
# File 'lib/mittsu/renderers/opengl/opengl_default_target.rb', line 3

def viewport_height
  @viewport_height
end

#viewport_widthObject Also known as: width

Returns the value of attribute viewport_width.



3
4
5
# File 'lib/mittsu/renderers/opengl/opengl_default_target.rb', line 3

def viewport_width
  @viewport_width
end

#viewport_xObject

Returns the value of attribute viewport_x.



3
4
5
# File 'lib/mittsu/renderers/opengl/opengl_default_target.rb', line 3

def viewport_x
  @viewport_x
end

#viewport_yObject

Returns the value of attribute viewport_y.



3
4
5
# File 'lib/mittsu/renderers/opengl/opengl_default_target.rb', line 3

def viewport_y
  @viewport_y
end

Instance Method Details

#framebufferObject



15
16
17
# File 'lib/mittsu/renderers/opengl/opengl_default_target.rb', line 15

def framebuffer
  0
end

#set_and_use_viewport(x, y, width, height) ⇒ Object



36
37
38
39
# File 'lib/mittsu/renderers/opengl/opengl_default_target.rb', line 36

def set_and_use_viewport(x, y, width, height)
  set_viewport(x, y, width, height)
  use_viewport
end

#set_viewport(x, y, width, height) ⇒ Object



41
42
43
44
# File 'lib/mittsu/renderers/opengl/opengl_default_target.rb', line 41

def set_viewport(x, y, width, height)
  @viewport_x, @viewport_y = x, y
  set_viewport_size(width, height)
end

#set_viewport_size(width, height) ⇒ Object



46
47
48
# File 'lib/mittsu/renderers/opengl/opengl_default_target.rb', line 46

def set_viewport_size(width, height)
  @viewport_width, @viewport_height = width, height
end

#setup_buffersObject



23
24
25
# File 'lib/mittsu/renderers/opengl/opengl_default_target.rb', line 23

def setup_buffers
  # NOOP
end

#update_mipmapObject



19
20
21
# File 'lib/mittsu/renderers/opengl/opengl_default_target.rb', line 19

def update_mipmap
  # NOOP
end

#useObject



27
28
29
30
# File 'lib/mittsu/renderers/opengl/opengl_default_target.rb', line 27

def use
  glBindFramebuffer(GL_FRAMEBUFFER, 0)
  use_viewport
end

#use_viewportObject



32
33
34
# File 'lib/mittsu/renderers/opengl/opengl_default_target.rb', line 32

def use_viewport
  glViewport(@viewport_x, @viewport_y, @viewport_width, @viewport_height)
end