attribute vec4 in_pnt1;
attribute vec4 in_pnt2;
attribute vec4 in_ctrl1;
attribute vec4 in_ctrl2;

void main(void) {
  vec4 p1=gl_ModelViewProjectionMatrix*in_pnt1;
  vec4 p2=gl_ModelViewProjectionMatrix*in_pnt2;
  vec4 c1=gl_ModelViewProjectionMatrix*in_ctrl1;
  vec4 c2=gl_ModelViewProjectionMatrix*in_ctrl2;

  p1/=p1.w;
  p2/=p2.w;
  c1/=c1.w;
  c2/=c2.w;

  c1-=p1;
  c2-=p1;
  p2-=p1;

  if (sign(p2.x*c1.y - p2.y*c1.x) == sign(p2.x*c2.y - p2.y*c2.x))
  {
    gl_Position=gl_ModelViewProjectionMatrix*gl_Vertex;
    gl_FrontColor=gl_Color;
  }
  else
    gl_Position=vec4(0, 0, 0, 0);
}
