I'm not sure if it's the proper way to do it, but here's how I do it. (at least it works ^^ )
Add to your cpp Frag.setParameter("texture", sf::Shader::CurrentTexture);
Add to your your fragment shader uniform sampler2D texture;
and use vec4 pixel = gl_Color * texture2D(texture, gl_TexCoord[0].st);
Thanks a lot ! It's working !
Thanks for taking a look, makes me glad you took the time = )
But still I'm quite curious about a method without using an access to the texture.
I mean if :
void main()
{
gl_FragColor = gl_Color;
}
is actually what the standard pipeline of OpenGL does, than there must be data flowing, which represents the sprites vertex color ?
I think when applying the shader to the sprite, the shader does only retrieve the pixels behind the sprite, which is indeed the white background drawn with
App.clear() (therefor the pure white pixels I received in the shader)
I'll keep this question here for some time, because it's SFML related, but I think I might visit some OpenGL forums for more information about it ...
It sets the current Texture (the one used by the sprite) and gets the color of the current pixel.
I thought only techniques like bump-mapping or effects on textures itself would require such a method.