void GLFramebuffer::setDepthbufferTexture(GLTexture& a_texture) { assert(m_initialized); assert(uint(m_multiSampleType) == uint(a_texture.getMultiSampleType())); m_depthTexture = a_texture.getTextureID(); CHECK_GL_ERROR() glBindFramebuffer(GL_FRAMEBUFFER, m_fbo); glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, a_texture.getTextureID(), 0); GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); assert(status == GL_FRAMEBUFFER_COMPLETE); glBindFramebuffer(GL_FRAMEBUFFER, 0); CHECK_GL_ERROR(); }
void GLFramebuffer::addFramebufferTexture(GLTexture& a_texture, EAttachment a_attachment) { assert(m_initialized); assert(uint(m_multiSampleType) == uint(a_texture.getMultiSampleType())); m_textures.push_back(a_texture.getTextureID()); m_drawBuffers.push_back(a_attachment); CHECK_GL_ERROR(); glBindFramebuffer(GL_FRAMEBUFFER, m_fbo); glFramebufferTexture(GL_FRAMEBUFFER, GLenum(a_attachment), a_texture.getTextureID(), 0); glDrawBuffers(uint(m_drawBuffers.size()), rcast<GLenum*>(&m_drawBuffers[0])); GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); assert(status == GL_FRAMEBUFFER_COMPLETE); glBindFramebuffer(GL_FRAMEBUFFER, 0); CHECK_GL_ERROR(); }