#version 430 core
layout (points) in;
layout (triangle_strip, max_vertices = 4) out;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
out float lum;
out vec2 dField;
void main()
{
  lum = gl_in[0].gl_Position.w;
  vec4 cenPos = vec4( gl_in[0].gl_Position.xy, 0.1 , 1);
  float gRad = gl_in[0].gl_Position.z;

  dField = vec2 ( 1, 1);
  gl_Position = theMat * vec4 (cenPos.x + gRad, cenPos.y + gRad, 0.1 , 1);
  EmitVertex();
  dField = vec2 (-1, 1);
  gl_Position = theMat * vec4 (cenPos.x - gRad, cenPos.y + gRad, 0.1 , 1);
  EmitVertex();
  dField = vec2 ( 1,-1);
  gl_Position = theMat * vec4 (cenPos.x + gRad, cenPos.y - gRad, 0.1 , 1);
  EmitVertex();
  dField = vec2 (-1,-1);
  gl_Position = theMat * vec4 (cenPos.x - gRad, cenPos.y - gRad, 0.1 , 1);
  EmitVertex();

  EndPrimitive();
}
