diff --git a/Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp b/Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp index f210f0d70f..30a7bd96a3 100644 --- a/Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/GLContextState.cpp @@ -213,6 +213,8 @@ void GLContextState::SetActiveTexture(Int32 Index) void GLContextState::BindTexture(Int32 Index, GLenum BindTarget, const GLObjectWrappers::GLTextureObj& TexObj) { + VERIFY_EXPR(BindTarget != 0); + if (Index < 0) { Index += m_Caps.MaxCombinedTexUnits; diff --git a/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp b/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp index b064afd01a..9c66cf5947 100644 --- a/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/TextureBaseGL.cpp @@ -728,7 +728,9 @@ void TextureBaseGL::CopyData(DeviceContextGLImpl* pDeviceCtxGL, // Invalidate FBO as we used glBindFramebuffer directly GLState.InvalidateFBO(); - GLState.BindTexture(-1, GetBindTarget(), GLObjectWrappers::GLTextureObj::Null()); + if (!IsDefaultBackBuffer) + GLState.BindTexture(-1, GetBindTarget(), GLObjectWrappers::GLTextureObj::Null()); + pDeviceCtxGL->CommitRenderTargets(); } }