SFML community forums

Help => Graphics => Topic started by: mkalex777 on February 22, 2019, 10:41:45 am

Title: How to draw Texture with black and white colors?
Post by: mkalex777 on February 22, 2019, 10:41:45 am
I draw Texture on circle shape and it works. All textures are colored.
But I want to draw it with black and white tints in some cases.
Is it possible with no need to modify image and no need to load second copy of texture (black and white version)?
Title: Re: How to draw Texture with black and white colors?
Post by: fallahn on February 22, 2019, 11:02:39 am
It's entirely possible with shaders, where you can control the output of individual channels or desaturate the image entirely, and do it dynamically at runtime. A crude example would be to sum the rgb values and divide them by 3, although there are many more accurate methods of doing this. Google is you friend here! :)