         } else if ( fillMode == LOOP) {
             coord.x -= 1.0;
         } else if ( fillMode == MIRROR) {
-            coord.x = 1.0 - (coord.x - 1.0);
+            coord.x = 2.0 - coord.x;
         } else {
             gl_FragColor = vec4(0., 0., 0., 0.);
             return;


    float ny = (-sinDir * cx + cosDir * cy) / aspect + 0.5;

    ny = ny < 0. ? 1. + ny : (ny > 1. ? ny - 1. : ny);

    vec4 dc = texture2D(displacementMap, vec2(0.5, ny));


        } else if ( fillMode == LOOP) {
            coord.y -= 1.0;
        } else if ( fillMode == MIRROR) {
            coord.y = 2.0 - coord.y;
        } else {
            gl_FragColor = vec4(0., 0., 0., 0.);
            return;
