#version 430 core
layout (points) in;
layout (triangle_strip, max_vertices = 4) out;
in vec4 vColor [];
in float vRad [];
out vec4 gColor;
out float gRad;
out vec2 cenPosT;

uniform vec2 winSize;
uniform float zoom;

void main()
{
  vec3 cenPos = gl_in[0].gl_Position.xyz;
  //cenPos = vec3 (0.5,0,0);
  gColor = vColor[0];
  gRad = vRad[0] * zoom * 2;
//  gRad = 0.2;

  cenPosT = vec2 ( (cenPos.x + 1) * 0.5 * winSize.x , (cenPos.y + 1) * 0.5 * winSize.y);

  gl_Position = vec4 (cenPos.x + gRad/winSize.x, cenPos.y + gRad/winSize.y, cenPos.z , 1);
  EmitVertex();
  gl_Position = vec4 (cenPos.x - gRad/winSize.x, cenPos.y + gRad/winSize.y, cenPos.z , 1);
  EmitVertex();
  gl_Position = vec4 (cenPos.x + gRad/winSize.x, cenPos.y - gRad/winSize.y, cenPos.z , 1);
  EmitVertex();
  gl_Position = vec4 (cenPos.x - gRad/winSize.x, cenPos.y - gRad/winSize.y, cenPos.z , 1);
  EmitVertex();

  EndPrimitive();
}
