Class: Roglew::Texture2dContext

Inherits:
Object
  • Object
show all
Defined in:
lib/roglew/extensions/GL_EXT_framebuffer_object.rb,
lib/roglew/texture2d_context.rb

Overview

TODO refactor this to only exist by using RenderContext#create_texture2d

Defined Under Namespace

Modules: Parameters1, Parameters2, Parameters3, Parameters4, Parameters5, Parameters6

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(texture, deferred, target, level, &block) ⇒ Texture2dContext

Returns a new instance of Texture2dContext.



10
11
12
13
14
15
16
17
# File 'lib/roglew/texture2d_context.rb', line 10

def initialize(texture, deferred, target, level, &block)
  @target, @level = target, level

  load_version_modules texture.handle.version
  load_extensions texture.handle.loaded_extensions

  super(texture, deferred, &block)
end

Instance Attribute Details

#levelObject

Returns the value of attribute level.



5
6
7
# File 'lib/roglew/texture2d_context.rb', line 5

def level
  @level
end

Instance Method Details

#border_color(r, g, b, a) ⇒ Object



31
# File 'lib/roglew/texture2d_context.rb', line 31

def border_color(r, g, b, a) parameter(GL::TEXTURE_BORDER_COLOR, r, g, b, a) end

#generate_mipmapEXTObject



60
61
62
# File 'lib/roglew/extensions/GL_EXT_framebuffer_object.rb', line 60

def generate_mipmapEXT
  glGenerateMipmapEXT(@target)
end

#mag_filter=(v) ⇒ Object



32
# File 'lib/roglew/texture2d_context.rb', line 32

def mag_filter=(v) parameter(GL::TEXTURE_MAG_FILTER, v) end

#min_filter=(v) ⇒ Object



33
# File 'lib/roglew/texture2d_context.rb', line 33

def min_filter=(v) parameter(GL::TEXTURE_MIN_FILTER, v) end

#parameter(pname, *values) ⇒ Object



19
20
21
# File 'lib/roglew/texture2d_context.rb', line 19

def parameter(pname, *values)
  tex_parameter(@target, pname, *values)
end

#tex_image_2d(width, height, internalFormat, format, type, data = nil) ⇒ Object



23
24
25
# File 'lib/roglew/texture2d_context.rb', line 23

def tex_image_2d(width, height, internalFormat, format, type, data = nil)
  glTexImage2D(@target, @level, internalFormat, width, height, 0, format, type, data)
end

#tex_subimage_2d(x, y, width, height, format, type, data = nil) ⇒ Object



27
28
29
# File 'lib/roglew/texture2d_context.rb', line 27

def tex_subimage_2d(x, y, width, height, format, type, data = nil)
  glTexSubImage2D(@target, @level, x, y, width, height, format, type, data)
end

#wrap_s=(v) ⇒ Object



34
# File 'lib/roglew/texture2d_context.rb', line 34

def wrap_s=(v) parameter(GL::TEXTURE_WRAP_S, v) end

#wrap_t=(v) ⇒ Object



35
# File 'lib/roglew/texture2d_context.rb', line 35

def wrap_t=(v) parameter(GL::TEXTURE_WRAP_T, v) end