Hey I have a simple problem. It seems that the clear function of a RenderTexture doens't work for me.
Minimal example (It's the renderTexture example + a RectangleShape updated to the mouse position (to draw some stuff
):
#include <SFML\Graphics.hpp>
int main()
{
// Create a new render-window
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
// Create a new render-texture
sf::RenderTexture texture;
if (!texture.create(500, 500))
return -1;
// Create rectangle
sf::RectangleShape rect;
rect.setSize({ 25.f, 25.f });
// The main loop
while (window.isOpen())
{
// Event processing
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
//Update the rect position to mouse position (to draw some stuf :P)
rect.setPosition(static_cast<sf::Vector2f>(sf::Mouse::getPosition(window)));
// Clear the whole texture with red color
texture.clear(sf::Color::Red);
// Draw stuff to the texture
texture.draw(rect);
// We're done drawing to the texture
texture.display();
// Now we start rendering to the window, clear it first
window.clear();
// Draw the texture
sf::Sprite sprite(texture.getTexture());
window.draw(sprite);
// End the current frame and display its contents on screen
window.display();
}
return 0;
}
The result for me:
http://imgur.com/DEFr4FbWhat I would expect:
http://imgur.com/gsTZJfd = only one rectangle. When I draw directly on a window everything works fine.
My system:
OS: Windows 8 64bit
GPU: AMD 6850 (I have the lastest beta driver)
(I don't think the CPU/Ram are important for this issue but anyways)
CPU: AMD FX-8350
RAM: 8gb 1600mhz
Sadly I have currently no other PC to test it.
AlexAUT