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

Author Topic: Shader in sf::Drawable  (Read 802 times)

0 Members and 1 Guest are viewing this topic.

GamDev

  • Newbie
  • *
  • Posts: 29
    • View Profile
Shader in sf::Drawable
« on: June 07, 2018, 07:48:31 pm »
Hello, please tell me it's possible to do this:
I have an image size of 128x64, that is 2 sprite.
I draw them like this:
(click to show/hide)
Tell me, please, is it possible to use the shader only on the second sprite inside the DrawTileMap class?
« Last Edit: June 07, 2018, 07:53:36 pm by GamDev »

Hapax

  • Hero Member
  • *****
  • Posts: 3351
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Shader in sf::Drawable
« Reply #1 on: June 12, 2018, 12:25:43 am »
As I see it, you would need someway of telling the shader when and when not to be applied. One idea, if you don't need the alpha channels of the texture, is to make one of them fully transparent (still keeping the colours of course!). Then, in the shader, if check the texture's alpha channel and if it's higher or lower than half, apply the effect or pass the pixel unaffected.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*