1
Graphics / Re: Multiple layers and colorizing thereof
« on: December 18, 2012, 06:23:33 am »When rendering the rendertextures using a sprite, you have an option in sf::Sprite thats called "setColor". Take a look at this; http://www.sfml-dev.org/documentation/2.0/classsf_1_1Sprite.php#a14def44da6437bfea20c4df5e71aba4cOn re-reading my post, I realize that my sentence was rather ambiguously phrased (I'm terrible at succinct explanations, one might tell): as a source pixel's color approaches black, the drawn pixel's color should approach red (or blue). So far as I'm aware, sf::Sprite::setColor will only allow me to do the opposite (as a source pixel's color approaches white ...).
I've since noticed that I can pass a blend mode when drawing sprites, and this seems to mostly work; simply draw an image consisting of a block of flat color atop the desired layers with sf::BlendAdd. Clear my window with white, draw my lower layers in, color them red, draw my non-coloured layer.
The only problem is that this doesn't seem to preserve transparency - I draw to an sf::RenderTexture and it has the correct colors, but is fully opaque. And I can't sf::BlendAdd a block of blue directly to the window after drawing my red layers, or else they turn magenta.