Skip to content

Commit

Permalink
Fix render target creation not resetting state
Browse files Browse the repository at this point in the history
  • Loading branch information
Web-eWorks committed Nov 3, 2020
1 parent 9e18c21 commit 4a7167c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/graphics/opengl/RendererGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,14 @@ namespace Graphics {
rt->CheckStatus();
rt->Unbind();
CheckRenderErrors(__FUNCTION__, __LINE__);

// Rebind the active render target
if (m_activeRenderTarget)
m_activeRenderTarget->Bind();
// we can't assume the window render target exists yet because we might be creating it
else if (m_windowRenderTarget)
m_windowRenderTarget->Bind();

return rt;
}

Expand Down
6 changes: 3 additions & 3 deletions src/graphics/opengl/RendererGL.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ namespace Graphics {
std::unordered_map<Uint32, OGL::RenderState *> m_renderStates;
bool m_useNVDepthRanged;
float m_invLogZfarPlus1;
OGL::RenderTarget *m_activeRenderTarget;
OGL::RenderTarget *m_windowRenderTarget;
RenderState *m_activeRenderState;
OGL::RenderTarget *m_activeRenderTarget = nullptr;
OGL::RenderTarget *m_windowRenderTarget = nullptr;
RenderState *m_activeRenderState = nullptr;

matrix4x4f m_modelViewMat;
matrix4x4f m_projectionMat;
Expand Down

0 comments on commit 4a7167c

Please sign in to comment.