OpenGLRenderer: Improve/fix Framebuffer handling

This commit is contained in:
Jérôme Leclercq
2021-09-21 17:37:03 +02:00
parent 78358337f3
commit 4933a389a2
8 changed files with 43 additions and 57 deletions

View File

@@ -118,9 +118,13 @@ namespace Nz::GL
}
}
void Context::BindFramebuffer(GLuint fbo) const
GLenum Context::BindFramebuffer(GLuint fbo) const
{
if (m_state.boundDrawFBO != fbo || m_state.boundReadFBO != fbo)
if (m_state.boundDrawFBO == fbo)
return GL_DRAW_FRAMEBUFFER;
else if (m_state.boundReadFBO == fbo)
return GL_READ_FRAMEBUFFER;
else
{
if (!SetCurrentContext(this))
throw std::runtime_error("failed to activate context");
@@ -128,6 +132,7 @@ namespace Nz::GL
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
m_state.boundDrawFBO = fbo;
m_state.boundReadFBO = fbo;
return GL_FRAMEBUFFER;
}
}