// All content © 2010-2011 DigiPen (USA) Corporation, all rights reserved.

//Fragment shader to sum all pixel values in a texture

#version 150

// ---------------------------------------------------------------------------
//uniforms

//textures
uniform sampler2DRect	uReadTex; //texture to sample from

// ---------------------------------------------------------------------------
// from vertex shader

//tex coords of samples
in vec2					vTopLeft;

// ---------------------------------------------------------------------------
// output

out vec4			out_Color;

// ---------------------------------------------------------------------------

void main()
{
	//sum up a 2x2 block of pixels
	out_Color = texture( uReadTex, vTopLeft ) //top left
				+ texture( uReadTex, vec2( vTopLeft.s + 1.0, vTopLeft.t ) )//top right
				+ texture( uReadTex, vec2( vTopLeft.s , vTopLeft.t - 1.0 ) ) //bottom left
				+ texture( uReadTex, vec2( vTopLeft.s + 1.0, vTopLeft.t - 1.0 ) ); //bottom right
}





