#version 330 core

//output
out FSQuadOutput
{
	vec2 p; //position [-1,1]
	vec2 t; //tex coords [0,1]
} outData;

// full screen quad (actually triangle) vertex shader, without input vertices
// call with glDrawArrays(GL_TRIANGLES,0,3)
// see http://www.altdevblogaday.com/2011/08/08/interesting-vertex-shader-trick/
void main(void)
{
	outData.t = vec2( (gl_VertexID << 1) & 2, gl_VertexID & 2);
	//positions are [-1,-1], [3,-1], [-1,3]
	//this results in a clipped fullscreen quad with opengl like texcoords, i.e. [0,0] bottom left, [1,1] top right
	outData.p = 2.0f * outData.t - 1.0f;
	gl_Position = vec4(outData.p, 0.0f, 1.0f);
}