add multisampled fbo support + multisampled fixes

This commit is contained in:
2022-02-17 16:27:49 +01:00
parent 4304701e5e
commit 60aca24ec6
4 changed files with 20 additions and 8 deletions

View File

@@ -47,7 +47,11 @@ FBOBuilder& FBOBuilder::attachTexture(std::shared_ptr<Texture> tex, GLuint attac
}
//glFramebufferTexture2D(target, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex->getHandle(), 0);
glFramebufferTexture2D(target, attachment_type, GL_TEXTURE_2D, tex->getHandle(), 0);
if (tex->samples == 0u) {
glFramebufferTexture2D(target, attachment_type, GL_TEXTURE_2D, tex->getHandle(), 0);
} else {
glFramebufferTexture2D(target, attachment_type, GL_TEXTURE_2D_MULTISAMPLE, tex->getHandle(), 0);
}
_fbo->_texAttachments.push_back(tex); // keep a ref at the fbo
return *this;