Class: Mittsu::OpenGLCompressedTexture

Inherits:
OpenGLTexture show all
Defined in:
lib/mittsu/renderers/opengl/textures/opengl_compressed_texture.rb

Instance Attribute Summary

Attributes inherited from OpenGLTexture

#opengl_texture

Instance Method Summary collapse

Methods inherited from OpenGLTexture

#initialize, #set, #update

Constructor Details

This class inherits a constructor from Mittsu::OpenGLTexture

Instance Method Details

#update_specificObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/mittsu/renderers/opengl/textures/opengl_compressed_texture.rb', line 3

def update_specific
  gl_format = GL_MITTSU_PARAMS[@texture.format]
  gl_type = GL_MITTSU_PARAMS[@texture.type]
  mipmaps = @texture.mipmaps

  mipmaps.each_with_index do |mipmap, i|
    if @texture.format != RGBAFormat && @texture.format != RGBFormat
      if @renderer.compressed_texture_formats.include?(gl_format)
        glCompressedTexImage2D(GL_TEXTURE_2D, i, gl_format, mipmap.width, mipmap.height, 0, mipmap.data)
      else
        puts 'WARNING: Mittsu::OpenGLTexture: Attempt to load unsupported compressed texture format in #update_texture'
      end
    else
      glTexImage2D(GL_TEXTURE_2D, i, gl_format, mipmap.width, mipmap.height, 0, gl_format, gl_type, mipmap.data)
    end
  end
end