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

Author Topic: Changing RenderTexture color  (Read 2689 times)

0 Members and 3 Guests are viewing this topic.

orella

  • Newbie
  • *
  • Posts: 10
    • View Profile
Changing RenderTexture color
« on: April 24, 2017, 10:23:34 am »
Is possible to change the color of a RenderTexture without changing the colors of the sprites on the texture?

RenderTexture white:



RenderTexture green:




orella

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Changing RenderTexture color
« Reply #1 on: April 24, 2017, 10:34:47 am »
NVM i found how to do that XDD

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Changing RenderTexture color
« Reply #2 on: April 24, 2017, 12:12:35 pm »
renderTexture.clear(sf::Color::Green);
renderTexture.draw(sprite);
renderTexture.display();
Something like that by any chance? :)
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Changing RenderTexture color
« Reply #3 on: April 24, 2017, 12:14:01 pm »
That only changes the background, not the whole thing. One solution is to set the color of the sprite that displays the content of the render-texture.
Laurent Gomila - SFML developer

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Changing RenderTexture color
« Reply #4 on: April 24, 2017, 12:15:59 pm »
Is possible to change the color of a RenderTexture without changing the colors of the sprites on the texture?
Did I maybe misunderstand this sentence?
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Changing RenderTexture color
« Reply #5 on: April 24, 2017, 12:47:14 pm »
Quote
Did I maybe misunderstand this sentence?
Ah, maybe it's me. I focused on the images, thinking they were showing the desired result.

Anyway, the problem is solved so let's stop making this thread longer than necessary :)
Laurent Gomila - SFML developer

 

anything