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

Author Topic: RenderImage.Clear(...) issue  (Read 1346 times)

0 Members and 1 Guest are viewing this topic.

krisando

  • Newbie
  • *
  • Posts: 20
    • View Profile
RenderImage.Clear(...) issue
« on: July 10, 2011, 10:22:42 am »
I'm using the RenderImage class due to the surface like nature of it. Also am unsure whether this is a bug or misuse.

I create the image like so:
Code: [Select]
sf::RenderImage surface;
surface.Create(512, 512);


And believe the clear function can take:
sf::Color(255, 0, 0, 255)
sf::Color::Red
...

Red looks like a preset copy of the latter. You can see I'm testing this by making the image completely red.

Code: [Select]
surface.Clear(sf::Color(0, 255, 0, 255));
window.Draw(surface);


The result is a 512x512 black block.

Then I thought maybe it will clear the area in the view, not sure if the 2.0 documentation is outdated with this class but I tried this:

Code: [Select]
sf::View view;
view.Reset(sf::FloatRect(100, 100, 400, 200));

sf::RenderImage surface;
surface.SetView(surface);  //No function in class SetView()


Am I going about clearing the RenderImage with a specific colour?

Kris

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
RenderImage.Clear(...) issue
« Reply #1 on: July 10, 2011, 12:44:54 pm »
Try this:
Code: [Select]
surface.Clear(sf::Color::Red);
surface.Display();

window.Draw(sf::Sprite(surface));


The documentation is not outdated, the SetView function is in the RenderTarget base class.
Laurent Gomila - SFML developer