#version 430 core
layout (triangles) in;
layout (triangle_strip, max_vertices = 4) out;
in vec4 vCol[];
out vec4 gColorC;
out vec4 gColorE;
out vec2 gBoundingBox;

void main()
{
  vec4 pa = gl_in[0].gl_Position;
  vec4 pb = gl_in[1].gl_Position;
  vec4 pc = gl_in[2].gl_Position;
  gColorC = vCol[0];
  gColorE = vCol[1];

  gBoundingBox = vec2 (-1,1);
  gl_Position = pb;
  EmitVertex();
  gBoundingBox = vec2 (1,1);
  gl_Position = pa;
  EmitVertex();
  gBoundingBox = vec2 (-1,-1);
  gl_Position = pc;
  EmitVertex();
  gBoundingBox = vec2 (1,-1);
  gl_Position = pa + pc - pb;
  EmitVertex();

  EndPrimitive();
}
