uniform sampler2DRect uOutgoingTexture;
uniform sampler2DRect uIncomingTexture;
uniform vec2 uTextureCenter;
uniform float uFactor;
uniform float uAlpha;

void main()
{
	// Get texture coordinate and modify it to create the pixelate effect. Use the   
	// floor function to create a stair with factor being the width of the steps...
	
	vec2 coord = gl_TexCoord[0].xy;
	coord -= uTextureCenter;
	coord /= uFactor;
	coord = floor(coord);
	coord *= uFactor;
	coord += uTextureCenter;
	
	// Get the current pixel color (by mixing outgoing and incoming textures)...
	
	vec4 outgoingColor = texture2DRect(uOutgoingTexture,coord);
	vec4 incomingColor = texture2DRect(uIncomingTexture,coord);
	gl_FragColor = mix(outgoingColor,incomingColor,uAlpha);
}
