Sha256: 37953a6a39149eaf361d2250f2a59e63166b909f8c543153c18cbf3d9d2990a4

Contents?: true

Size: 1 KB

Versions: 16

Compression:

Stored size: 1 KB

Contents

module Mittsu
  class OpenGLDefaultTarget
    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
      glBindFramebuffer(GL_FRAMEBUFFER, 0)
      use_viewport
    end

    def use_viewport
      glViewport(@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

16 entries across 16 versions & 1 rubygems

Version Path
mittsu-0.4.1 lib/mittsu/renderers/opengl/opengl_default_target.rb
mittsu-0.4.0 lib/mittsu/renderers/opengl/opengl_default_target.rb
mittsu-0.3.3 lib/mittsu/renderers/opengl/opengl_default_target.rb
mittsu-0.3.2 lib/mittsu/renderers/opengl/opengl_default_target.rb
mittsu-0.3.1 lib/mittsu/renderers/opengl/opengl_default_target.rb
mittsu-0.3.0 lib/mittsu/renderers/opengl/opengl_default_target.rb
mittsu-0.2.4 lib/mittsu/renderers/opengl/opengl_default_target.rb
mittsu-0.2.3 lib/mittsu/renderers/opengl/opengl_default_target.rb
mittsu-0.2.2 lib/mittsu/renderers/opengl/opengl_default_target.rb
mittsu-0.2.1 lib/mittsu/renderers/opengl/opengl_default_target.rb
mittsu-0.2.0 lib/mittsu/renderers/opengl/opengl_default_target.rb
mittsu-0.1.7 lib/mittsu/renderers/opengl/opengl_default_target.rb
mittsu-0.1.6 lib/mittsu/renderers/opengl/opengl_default_target.rb
mittsu-0.1.5 lib/mittsu/renderers/opengl/opengl_default_target.rb
mittsu-0.1.4 lib/mittsu/renderers/opengl/opengl_default_target.rb
mittsu-0.1.3 lib/mittsu/renderers/opengl/opengl_default_target.rb