Method: RGSS::Texture#bind_framebuffer

Defined in:
lib/rgss/texture.rb

#bind_framebufferObject (protected)



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/rgss/texture.rb', line 112

def bind_framebuffer
  if @fbo.zero?
    @fbo = glGenFramebuffer
    glBindFramebuffer(GL_FRAMEBUFFER, @fbo);
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, self.id, 0);
  else
    glBindFramebuffer(GL_FRAMEBUFFER, @fbo);
  end  

  if block_given?
    yield
    glBindFramebuffer(GL_FRAMEBUFFER, GL_NONE)
  end

end