61
Graphics / Re: Fragment shader issue [possible bug]
« on: October 29, 2015, 07:41:20 am »
I just had a very quick look. But my first guess is that gl_FragCoord is in a different range in your project than it is for the glslsandbox example you linked to.
If you're using a sf::Sprite, gl_FragCoord x and y will be in the range of 0 to 1.
Your shader is comparing this to the "resolution" value. I don't know what you've got that set to, but I'm guessing screen resolution, or the size of the sprite (or both).
If this is the case, you're comparing stuff in screen space (resolution) to stuff in texture space (gl_FragCoord), and that's kinda apples and oranges. You'll need to convert both values to use the same coordinate space to have any meaningful comparison between them.
If you're using a sf::Sprite, gl_FragCoord x and y will be in the range of 0 to 1.
Your shader is comparing this to the "resolution" value. I don't know what you've got that set to, but I'm guessing screen resolution, or the size of the sprite (or both).
If this is the case, you're comparing stuff in screen space (resolution) to stuff in texture space (gl_FragCoord), and that's kinda apples and oranges. You'll need to convert both values to use the same coordinate space to have any meaningful comparison between them.