Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: render window Clear to colour not working  (Read 6017 times)

0 Members and 2 Guests are viewing this topic.

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
render window Clear to colour not working
« 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??
SFML 2.1

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
render window Clear to colour not working
« Reply #1 on: June 20, 2011, 03:04:59 pm »
Minimal code please ;)
Laurent Gomila - SFML developer

Cpl.Bator

  • Hero Member
  • *****
  • Posts: 540
    • View Profile
render window Clear to colour not working
« Reply #2 on: June 20, 2011, 03:31:21 pm »
Do you flip the buffer ? 'myWindow.Display();' ?

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
render window Clear to colour not working
« Reply #3 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 :(
SFML 2.1

Disch

  • Full Member
  • ***
  • Posts: 220
    • View Profile
render window Clear to colour not working
« Reply #4 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.

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
render window Clear to colour not working
« Reply #5 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.
SFML 2.1

 

anything