Sha256: a42d517cd8bcda789fedee9496f0d74e0da157ce5c828101f661fc3a0b5ee9f2

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

module Mittsu
  class OpenGL::DefaultTarget
    attr_accessor :viewport_width, :viewport_height, :viewport_x, :viewport_y
    alias :width :viewport_width
    alias :height :viewport_height

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

    def framebuffer
      0
    end

    def update_mipmap
      # NOOP
    end

    def setup_buffers
      # NOOP
    end

    def use
      GL.BindFramebuffer(GL::FRAMEBUFFER, 0)
      use_viewport
    end

    def use_viewport
      GL.Viewport(@viewport_x, @viewport_y, @viewport_width, @viewport_height)
    end

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

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mittsu-opengl-0.5.1 lib/mittsu/opengl/default_target.rb
mittsu-opengl-0.5.0 lib/mittsu/opengl/default_target.rb