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

Author Topic: How to mix opacity of textures (taken from images) according to a runtime value?  (Read 2476 times)

0 Members and 1 Guest are viewing this topic.

Predator106

  • Newbie
  • *
  • Posts: 43
    • View Profile
I'm trying to draw a day sky (blue) and during the evening, I want to slowly blend in another image/texture which is the dusk (orangish blue).

How can I do this? People mentioned using mix() and lerp (which is a HLSL term). I want to adjust my opacity as it blends in, as the time changes.

danikaze

  • Newbie
  • *
  • Posts: 38
    • View Profile
    • Email
use the sf::Sprite::setColor(sf::Color(255, 255, 255, alpha)) to do it ;)

Just control the alpha value interpolating it according to the desired time ;)

Predator106

  • Newbie
  • *
  • Posts: 43
    • View Profile
doesn't this set my sprite to be white?

gyscos

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
The sprite's "color" is only a filter, that is multiplied with its texture.

masskiller

  • Sr. Member
  • ****
  • Posts: 284
  • Pointers to Functions rock!
    • MSN Messenger - kyogre_jb@hotmail.com
    • View Profile
    • Email
Alternatively you could use a shader for it, but it's pretty much overkill for something that simple.
Programmer, Artist, Composer and Storyline/Script Writer of "Origin of Magic". If all goes well this could turn into a commercial project!

Finally back into the programming world!

 

anything