From fe778028a291d183e9b8175b7599652d87be7a02 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. Fixes #2630 --- 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 416752838..ae0a659a2 100644 --- a/src/SFML/Graphics/RenderTexture.cpp +++ b/src/SFML/Graphics/RenderTexture.cpp @@ -158,9 +158,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();