Drawing a cone

My following challege it to draw a cone inside a quad thanks to Shaders. I have developed a code that is near to be successful but it you pay attencion you will see it fails…

Any idea? a book or reference to draw figures in a plain?

Parametric equations (I dont know very well how to apply them)

x=(h-u)/h * r * cost heta
y=(h-u)/h * r * sint heta
z=u

VS

varying float myx;
varying float myy;
varying float myz;

void main()
{
gl_Position = ftransform();

myx = gl_Vertex.x;
myy = gl_Vertex.y;
myz = gl_Vertex.z;

}

FS

uniform float angle;// It serves to rotate the cone 0-360
varying float myx;
varying float myy;
varying float myz;

void main()
{
float degree = abs(cos(radians(angle)));
float x2 = myx;
x2 *= x2;
float y2 = myy / (1.0 - degree);
y2 *= y2;
float h = 1.0 * degree;
float r = 1.0;

if(myy >= 0.0 //Triangle in the positive y axis
&& myy <= h //Triangle cannot be higher than height
&& pow(myx,2.0) < pow( r - (myy/h),2.0) // It draws a triangle
|| x2 + y2 < pow(r,2.0) //It draws a a elipsoide
) {

gl_FragColor = vec4( 1.0, 0.0, 1.0, 1.0);

} else {

gl_FragColor = vec4( 0.0, 0.0, 1.0, 1.0);

}

}

Any tip is welcome

Here is what the parameter of the parametric ecuations are:
http://mathworld.wolfram.com/Cone.html