From 5eb57ae5f103947ab5ff4ad244d9c3fb640a3422 Mon Sep 17 00:00:00 2001 From: Bambo-Borris Date: Mon, 15 Jul 2024 00:53:30 +0100 Subject: [PATCH] Fix white square problem in OpenGL example Because the sf::Texture::m_texture value changes when the texture is reloaded from disk, we need to rebind the texture since the previously bound sf::Texture::m_texture value is no longer a valid identifier. --- examples/opengl/OpenGL.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/opengl/OpenGL.cpp b/examples/opengl/OpenGL.cpp index f3d451da2..7678e162b 100644 --- a/examples/opengl/OpenGL.cpp +++ b/examples/opengl/OpenGL.cpp @@ -221,6 +221,9 @@ int main() // We simply reload the texture to disable mipmapping texture = sf::Texture::loadFromFile(resourcesDir() / "logo.png").value(); + // Rebind the texture + sf::Texture::bind(&texture); + mipmapEnabled = false; } else if (texture.generateMipmap())