diff --git a/include/SFML/Graphics/Renderer.hpp b/include/SFML/Graphics/Renderer.hpp index ead24ca34..40a13b4e0 100644 --- a/include/SFML/Graphics/Renderer.hpp +++ b/include/SFML/Graphics/Renderer.hpp @@ -70,12 +70,6 @@ public : //////////////////////////////////////////////////////////// Renderer(RenderTarget& target); - //////////////////////////////////////////////////////////// - /// \brief Destructor - /// - //////////////////////////////////////////////////////////// - ~Renderer(); - //////////////////////////////////////////////////////////// /// \brief Initialize the renderer (set the default states, etc.) /// @@ -355,6 +349,7 @@ private : States myStatesStack[64]; ///< Stack of render states States* myStates; ///< Current set of render states const Image* myTexture; ///< Current texture + unsigned int myTextureId; ///< Current texture identifier (the sf::Image instance may be the same, but not the internal OpenGL texture) const Shader* myShader; ///< Current pixel shader Blend::Mode myBlendMode; ///< Current blending mode IntRect myViewport; ///< Current target viewport diff --git a/src/SFML/Graphics/Renderer.cpp b/src/SFML/Graphics/Renderer.cpp index a8480f60e..117fcde18 100644 --- a/src/SFML/Graphics/Renderer.cpp +++ b/src/SFML/Graphics/Renderer.cpp @@ -46,12 +46,6 @@ myViewportIsValid (false) } -//////////////////////////////////////////////////////////// -Renderer::~Renderer() -{ -} - - //////////////////////////////////////////////////////////// void Renderer::Initialize() { @@ -239,7 +233,7 @@ void Renderer::SetBlendMode(Blend::Mode mode) //////////////////////////////////////////////////////////// void Renderer::SetTexture(const Image* texture) { - if ((texture != myTexture) || !myTextureIsValid) + if ((texture != myTexture) || (texture && (texture->myTexture != myTextureId)) || !myTextureIsValid) { // Apply the new texture if (texture) @@ -249,6 +243,7 @@ void Renderer::SetTexture(const Image* texture) // Store it myTexture = texture; + myTextureId = texture ? texture->myTexture : 0; myTextureIsValid = true; } else if (texture)