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.
This commit is contained in:
Bambo-Borris 2024-07-15 00:53:30 +01:00 committed by Chris Thrasher
parent 72eb115551
commit 5eb57ae5f1

View File

@ -221,6 +221,9 @@ int main()
// We simply reload the texture to disable mipmapping // We simply reload the texture to disable mipmapping
texture = sf::Texture::loadFromFile(resourcesDir() / "logo.png").value(); texture = sf::Texture::loadFromFile(resourcesDir() / "logo.png").value();
// Rebind the texture
sf::Texture::bind(&texture);
mipmapEnabled = false; mipmapEnabled = false;
} }
else if (texture.generateMipmap()) else if (texture.generateMipmap())