61
General / Re: Question about GLSL alpha blending
« on: February 16, 2016, 03:46:06 am »It appears that shaders are applied before the entire thing is drawn to the target so no, I don't think a shader would have access to target area. (otherwise the shaders would be applied to the entire target too, right?)
I'm not sure of your process here. Are you drawing the objects and then applying the glow on the entire render texture?
Is it possible to just draw to that render texture each object using the shader individually?
If not, and you need to do the entire render texture at once, you may need an intermediary render texture.
I may be missing something obvious though.
Have you attempted this yet? What were the results and how did you go about it?
I was just attempting to implement this when I ran into the exact problem that you describe, that a shader does not appear to have access to pixels already drawn to the buffer. I had thought to first draw the background texture and then apply the glow over top of it, but I'm running into the problem of how to mask the glow to only show up over parts of the background that are opaque (ie nonzero alpha channel, ie the parts in the picture that aren't black).
I'm reading through the sfml documentation, and I'm having trouble finding any built in features that were meant to do this, but maybe there's some sort of workaround that I'm not thinking of? Am I missing something?