Class: Roglew::FramebufferContextARB

Inherits:
Object
  • Object
show all
Defined in:
lib/roglew/extensions/GL_ARB_framebuffer_object/framebuffer_context.rb

Instance Method Summary collapse

Constructor Details

#initialize(framebuffer, deferred, target, &block) ⇒ FramebufferContextARB

Returns a new instance of FramebufferContextARB.



29
30
31
32
# File 'lib/roglew/extensions/GL_ARB_framebuffer_object/framebuffer_context.rb', line 29

def initialize(framebuffer, deferred, target, &block)
  @target = target
  super(framebuffer, deferred, &block)
end

Instance Method Details

#attach(obj, attachment, level = 0) ⇒ Object



34
35
36
37
38
39
40
41
42
43
# File 'lib/roglew/extensions/GL_ARB_framebuffer_object/framebuffer_context.rb', line 34

def attach(obj, attachment, level = 0)
  case obj
    when RenderbufferARB
      glFramebufferRenderbuffer(@target, attachment, GL::RENDERBUFFER, obj.id)
    when Texture2d
      #TODO glFramebufferTexture1D glFramebufferTexture3D
      glFramebufferTexture2D(@target, attachment, GL::TEXTURE_2D, obj.id, level)
    else raise ArgumentError, "first parameter isn't a RenderbufferARB nor a Texture2d"
  end
end

#blit(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter) ⇒ Object



45
46
47
# File 'lib/roglew/extensions/GL_ARB_framebuffer_object/framebuffer_context.rb', line 45

def blit(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter)
  glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter)
end

#texture_layer(texture, attachment, layer, level = 0) ⇒ Object

Raises:

  • (ArgumentError)


49
50
51
52
# File 'lib/roglew/extensions/GL_ARB_framebuffer_object/framebuffer_context.rb', line 49

def texture_layer(texture, attachment, layer, level = 0)
  raise ArgumentError, "first parameter isn't of type Texture3d" unless texture.is_a? Texture3d
  glFramebufferTextureLayer(@target, attachment, texture.id, level, layer)
end