For example try a simple code of moving a sprite without clearing the window, instead of the clean sprite moving what you will have is the sprite image displaying itself as it moves, so it doesn't show movement, rather it displays the sprite at many different positions that it has taken overtime.
That's the effect he's trying to get.
Can you explain more clearly why not clearing a rendertexture is bad? To my understanding clear() only paints the whole render target in a single color.
I'm not sure about this. It could very well be that it's okay for render texture but not for the window...
I thought about storing all the element individually, but is not an option for my program, because it's only a small program, but it has quiet a lot of elements, so it would use unreasonably huge amounts of memory. And that's not very efficient.
What numbers are we talking about here?
I'd say you would need to care for the memory usage it's not as much as a problem as the storing/erasing/drawing itself.
I've seen your application but I don't know how you did it, so I can't help you further on how to optimize.
I'm not sure how SFML handles the blending but from my understanding this shouldn't be the expected behavior. It should keep going dimmer and dimmer until the decimal points get rounded to 0.
But instead the darkness depends on the alpha channel you're using.
For instance, if you set the color to (0, 0, 0, 1) the result will look like:
But if you use (0, 0, 0, 10) you'll get:
Testing code:
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(1024, 768), "SFML");
window.setFramerateLimit(60);
sf::RenderTexture m_RenderTexture;
m_RenderTexture.create(window.getSize().x, window.getSize().y);
sf::Sprite m_RenderSprite;
sf::RectangleShape FadeRect(sf::Vector2f(window.getSize()));
FadeRect.setFillColor(sf::Color(0, 0, 0, 1));
sf::CircleShape circle;
circle.setRadius(10);
circle.setFillColor(sf::Color::Red);
m_RenderSprite.setTexture(m_RenderTexture.getTexture());
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
circle.setPosition(sf::Vector2f(sf::Mouse::getPosition(window)));
m_RenderTexture.draw(circle);
m_RenderTexture.draw(FadeRect);
m_RenderTexture.display();
window.clear();
window.draw(m_RenderSprite);
window.display();
}
}