From 0093224c8c5b4d6a3e9b25542e07ab35a041633f Mon Sep 17 00:00:00 2001 From: binary1248 Date: Sun, 8 Oct 2023 01:06:35 +0200 Subject: [PATCH] Fixed RenderTarget tracking not being notified to update its active target when an FBO RenderTexture is display()ed. --- src/SFML/Graphics/RenderTexture.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/SFML/Graphics/RenderTexture.cpp b/src/SFML/Graphics/RenderTexture.cpp index 95cfa55ad..4b5cba931 100644 --- a/src/SFML/Graphics/RenderTexture.cpp +++ b/src/SFML/Graphics/RenderTexture.cpp @@ -163,9 +163,22 @@ bool RenderTexture::setActive(bool active) //////////////////////////////////////////////////////////// void RenderTexture::display() { - // Update the target texture - if (m_impl && (priv::RenderTextureImplFBO::isAvailable() || setActive(true))) + if (m_impl) { + if (priv::RenderTextureImplFBO::isAvailable()) + { + // Perform a RenderTarget-only activation if we are using FBOs + if (!RenderTarget::setActive()) + return; + } + else + { + // Perform a full activation if we are not using FBOs + if (!setActive()) + return; + } + + // Update the target texture m_impl->updateTexture(m_texture.m_texture); m_texture.m_pixelsFlipped = true; m_texture.invalidateMipmap();