uniform sampler2D tex;
uniform float cellSize;
void main(void)
{
	
	vec2 thisTCoord=vec2(gl_TexCoord[0]);


        float cellSizeR = (cellSize-100.0)*0.5;
        if(cellSize==0.0)
         cellSizeR=300.0;
        thisTCoord *= (cellSizeR);


        thisTCoord = ceil (thisTCoord);
                thisTCoord /=(cellSizeR);
//thisTCoord.x +=0.5;	
//thisTCoord.y +=0.5;
thisTCoord = clamp(thisTCoord,vec2(0.0,0.0),vec2(1.0,1.0));
        vec4 value = texture2D(tex,thisTCoord);
	gl_FragColor = value;
}


