SFML community forums

Help => Graphics => Topic started by: slotdev on June 20, 2011, 02:03:13 pm

Title: render window Clear to colour not working
Post by: slotdev on June 20, 2011, 02:03:13 pm
Hi

When I clear my render window, I want to fill it with a colour to do some kind of effects. I leave a portion of my background image transparent, so when I set the colour of the render Clear, I should see the colour I set.

But, it's not working :(

Every frame, I do this:

Code: [Select]
myWindow.Clear(sf::Color::Green);

I see the green when I open the window first of all and clear it, but after this, it's just black! I have check my graphics and they are all OK. I am using 32 bit PNGs.

Any ideas??
Title: render window Clear to colour not working
Post by: Laurent on June 20, 2011, 03:04:59 pm
Minimal code please ;)
Title: render window Clear to colour not working
Post by: Cpl.Bator on June 20, 2011, 03:31:21 pm
Do you flip the buffer ? 'myWindow.Display();' ?
Title: render window Clear to colour not working
Post by: slotdev on June 20, 2011, 04:08:42 pm
With pleasure :)

Code: [Select]

myWindow.Clear(sf::Color::Green);
myWindow.Draw(mySprite);
// Now actually show it
myWindow.Display();


As I said, I just get a black background no matter what :(
Title: render window Clear to colour not working
Post by: Disch on June 20, 2011, 04:22:50 pm
Laurent was looking for a minimal program that reproduces the problem.

IE:  give us something that we can compile and run and see the problem for ourselves.

What you posted isn't enough, as that problem might be elsewhere in your program.
Title: render window Clear to colour not working
Post by: slotdev on June 20, 2011, 04:54:31 pm
Sorry guys - it was my mistake all along (so what's new). I actually had 2 windows and I was clearing the wrong one! What a dunce.

Thanks anyway.