// Input vertex data, different for all executions of this shader.
attribute vec2 vertexPosition_screenspace;
attribute vec2 vertexUV;

uniform vec2 screenSizeHalf;
// Output data ; will be interpolated for each fragment.
varying vec2 UV;

void main(){

	// Output position of the vertex, in clip space
	// map [0..800][0..600] to [-1..1][-1..1]
	vec2 vertexPosition_homoneneousspace = vertexPosition_screenspace - screenSizeHalf; // [0..800][0..600] -> [-400..400][-300..300]
	vertexPosition_homoneneousspace.x = vertexPosition_homoneneousspace.x / screenSizeHalf.x;
	vertexPosition_homoneneousspace.y = vertexPosition_homoneneousspace.y / screenSizeHalf.y;
	gl_Position =  vec4(vertexPosition_homoneneousspace,0,1);
	
	// UV of the vertex. No special space for this one.
	UV = vertexUV;
}

