Class: Roglew::FramebufferContextEXT

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

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of FramebufferContextEXT.



27
28
29
30
# File 'lib/roglew/extensions/GL_EXT_framebuffer_object/framebuffer_context.rb', line 27

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

Instance Method Details

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



32
33
34
35
36
37
38
39
40
41
# File 'lib/roglew/extensions/GL_EXT_framebuffer_object/framebuffer_context.rb', line 32

def attach(obj, attachment, level = 0)
  case obj
    when RenderbufferEXT
      glFramebufferRenderbufferEXT(@target, attachment, GL::RENDERBUFFER_EXT, obj.id)
    when Texture2d
      #TODO glFramebufferTexture1DEXT glFramebufferTexture3DEXT
      glFramebufferTexture2DEXT(@target, attachment, GL::TEXTURE_2D, obj.id, level)
    else raise ArgumentError, "first parameter isn't a RenderbufferEXT nor a Texture2d"
  end
end