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

Author Topic: Changing Sprite Hue, Saturation, Brightness  (Read 3372 times)

0 Members and 1 Guest are viewing this topic.

Clairvoire

  • Newbie
  • *
  • Posts: 29
    • AOL Instant Messenger - Clairvoire
    • View Profile
    • http://clairvoire.deviantart.com
Changing Sprite Hue, Saturation, Brightness
« on: November 12, 2010, 02:45:44 am »
I'd want to make it so I can edit these values with my sprites.  sf::SetColor and sf::SetBlendMode seem to affect the sprites at a point where this sort of thing would be possible, but I cannot pinpoint where they take place in the source code.

Basically, I just want to know how I can take source_pixel.red, and apply a formula I made to it, before it's wrote to screen_pixel.red

Or maybe that ability already exists.  Would be awesome if it did!  It's the only thing I've missed from SDL, the ability to take control at the pixel level.

thePyro_13

  • Full Member
  • ***
  • Posts: 156
    • View Profile
Changing Sprite Hue, Saturation, Brightness
« Reply #1 on: November 12, 2010, 04:42:59 am »
You could grab the pixels from an image, edit them and then reload them. Seems kind of roundabout. And isn't ideal for sprites which use the same image.

It sounds like a job for shaders.

Clairvoire

  • Newbie
  • *
  • Posts: 29
    • AOL Instant Messenger - Clairvoire
    • View Profile
    • http://clairvoire.deviantart.com
Changing Sprite Hue, Saturation, Brightness
« Reply #2 on: November 12, 2010, 07:56:38 am »
Yeah, was hoping to keep images only loaded up once.  But Shaders... I have heard them here and there when I skimmed the documentation, but never sunk my teeth into them really.  I thought they only worked on the screen itself.  I may be wrong, I'll have to investigate!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Changing Sprite Hue, Saturation, Brightness
« Reply #3 on: November 12, 2010, 08:05:32 am »
Quote
I thought they only worked on the screen itself. I may be wrong, I'll have to investigate!

True in SFML 1, wrong in SFML 2 ;)
Laurent Gomila - SFML developer