Improve emscripten support
This commit is contained in:
committed by
Jérôme Leclercq
parent
7cb90782de
commit
ea5c5240fc
@@ -147,11 +147,14 @@ namespace Nz::GL
|
||||
|
||||
GLenum Context::BindFramebuffer(GLuint fbo) const
|
||||
{
|
||||
// it looks like emscripten wants us to rebind the FBO everytime
|
||||
#ifndef NAZARA_PLATFORM_WEB
|
||||
if (m_state.boundDrawFBO == fbo)
|
||||
return GL_DRAW_FRAMEBUFFER;
|
||||
else if (m_state.boundReadFBO == fbo)
|
||||
return GL_READ_FRAMEBUFFER;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (!SetCurrentContext(this))
|
||||
throw std::runtime_error("failed to activate context");
|
||||
@@ -166,12 +169,10 @@ namespace Nz::GL
|
||||
void Context::BindFramebuffer(FramebufferTarget target, GLuint fbo) const
|
||||
{
|
||||
auto& currentFbo = (target == FramebufferTarget::Draw) ? m_state.boundDrawFBO : m_state.boundReadFBO;
|
||||
#ifdef NAZARA_PLATFORM_WEB
|
||||
constexpr bool isWeb = true;
|
||||
#else
|
||||
constexpr bool isWeb = false;
|
||||
// it looks like emscripten wants us to rebind the FBO everytime
|
||||
#ifndef NAZARA_PLATFORM_WEB
|
||||
if (currentFbo != fbo)
|
||||
#endif
|
||||
if (currentFbo != fbo || isWeb);
|
||||
{
|
||||
if (!SetCurrentContext(this))
|
||||
throw std::runtime_error("failed to activate context");
|
||||
|
||||
Reference in New Issue
Block a user