Hey guys,
So I have this problem:
I have a texture that is let's say 1024x1024.
I have a sprite with a subrect of 100,200,500x500.
I have a wave fragment shader that is this:
uniform sampler2D texture; //sf::Shader::CurrentTexture
uniform vec3 iResolution; //1000,800,1
uniform float time; //A Clock returning miliseconds
uniform float waveWidth; //50
uniform float amplitude; //150
uniform float speed; //100
void main()
{
vec2 colour = gl_FragCoord.xy / iResolution.xy;
colour.y = 1.0 - colour.y;
colour.y += sin(colour.x*waveWidth+(time/speed))/amplitude;
gl_FragColor = texture2D(texture,colour);
}
The problem is that the whole texture not just the subrect is being scaled to the size of the window and having the wave effect.
I have tried adding this code:
glViewport(100,200,500,500);
But this didn't work.
Anyone have any ideas of how I could maintain the subrect of the sprite?
Thanks everyone!