Shader cannot move texture x, y location


Hello I am trying to move the x y location of the texture using this code but it doest not work.

//Fragment shader
#version 120
#extension GL_ARB_texture_rectangle : enable
#extension GL_EXT_gpu_shader4 : enable

uniform sampler2DRect texture0;

void main(){
    //Getting coordinates of the current pixel in texture
    vec2 pos = gl_TexCoord[0].xy;

    // pos.x = (pos.x/0.5); //working
    pos.x += 0.2 //<-- not working how to fixed this?

    //Getting the pixel color from the texture texture0 in pos
    vec4 color = texture2DRect(texture0, pos);

    //Changing the color - invert red, green, blue components
    //color.r = 1.0 - color.r;
    color.g = 1.0 - color.g; //working..
    //color.b = 1.0 - color.b;

    //Output the color of shader
    gl_FragColor = color;
//Vertex shader
#version 120
#extension GL_ARB_texture_rectangle : enable
#extension GL_EXT_gpu_shader4 : enable

void main() {
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
    gl_TexCoord[0] = gl_MultiTexCoord0;
    gl_FrontColor = gl_Color;

whats wrong with this code? pos.x += 0.2 //not working how to fixed this?


I found the solution pos.x += 0.2 already working but it is not visible. if I tried bigger number like pos.x += 100 it is clear that the textures moves.

This is not working because each time you call in the fragment shader

pos.x += 0.2

You are just taking the actual position and adding 0.2. So, if your position is 12, each time you are just telling your shader to move your texture to 12.2. Nothing more. If you want to give a movement to your texture, try to use fract(time), and add it to you x component.
I really suggest you to go through “the book of shaders”.