Sha256: 7c5ad6d33761fe68884d71e0b1a1d887aab03a961853a7a7f727a720529241d1

Contents?: true

Size: 781 Bytes

Versions: 16

Compression:

Stored size: 781 Bytes

Contents

module Mittsu
  class DataTexture
    def update_specific
      gl_format = GL_MITTSU_PARAMS[format]
      gl_type = GL_MITTSU_PARAMS[type]
      is_image_power_of_two = Math.power_of_two?(image.width) && Math.power_of_two?(image.height)

      # use manually created mipmaps if available
      # if there are no manual mipmaps
      # set 0 level mipmap and then use GL to generate other mipmap levels

      if !mipmaps.empty? && is_image_power_of_two
        mipmaps.each_with_index do |mipmap, i|
          glTexImage2D(GL_TEXTURE_2D, i, gl_format, mipmap.width, mipmap.height, 0, gl_format, gl_type, mipmap.data)
        end
      else
        glTexImage2D(GL_TEXTURE_2D, 0, gl_format, image.width, image.height, 0, gl_format, gl_type, image.data)
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

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