varying vec3 center;
varying vec2 coord;
varying float radius;

varying vec4 position;

uniform mat4 pm;
uniform mat4 mvm;

uniform vec2 screensize;

void main()
{
  float ratio = screensize.y / screensize.x;

  vec4 b;
  float r = gl_Normal.x * 0.2;
  
  radius = r;
  
  if (gl_Normal.y == 0.0)
    b = vec4(-r, -r, 0.0, 0.0);
    
  if (gl_Normal.y == 0.1)
    b = vec4(+r, -r, 0.0, 0.0);
    
  if (gl_Normal.y == 0.2)
    b = vec4(+r, +r, 0.0, 0.0);
    
  if (gl_Normal.y == 0.3)
    b = vec4(-r, +r, 0.0, 0.0);
  
	coord=(b.xy + vec2(r)) / (2.0 * r);
  
  center = gl_Vertex;

  position = pm * mvm * gl_Vertex + pm * b /** vec4(ratio,1,1,1)*/;   
  gl_Position = position;
   
  gl_FrontColor = gl_Color;
  gl_TexCoord[0] = gl_MultiTexCoord0;
}