I managed to render an 3d egg object using GL_POINTS mode, I`ll post the code beneath, but now I need to render that egg not as a cloud of points but as a linked net of points, one of which has to be triangular net and the other square net. All I know is that I need to link those points in a specific order but I have no clue how to guess which points should I link.
Here’s the function that renders an egg:
void Egg(void)
{
double N = 80.0;
double x,y,z;
for(double u=0; u<1;)
{
for(double v=0; v<1;)
{
x = ax(u,v);
y = ay(u,v);
z = az(u,v);
glBegin( GL_POINTS );
glVertex3f(x,y,z);
glEnd();
v += 1/N;
}
u += 1/N;
}
glFlush();
}
and the functions that calculate next coordinates
double const Pi = 3.14159265359;
double ax(double u, double v)
{
return (( ((-90.0)(pow(u,5))) + (225.0(pow(u,4))) - (270.0*(pow(u,3))) + (180.0*(pow(u,2))) - (45.0u) ) * (cos(Piv)) );
}
double ay(double u, double v)
{
return ( (160.0*(pow(u,4))) - (320.0*(pow(u,3))) + (160.0*(pow(u,2))) );
}
double az(double u, double v)
{
return ( ( ((-90.0)(pow(u,5))) + (225.0(pow(u,4))) - (270.0*(pow(u,3))) + (180.0*(pow(u,2))) - (45u)) * (sin(Piv)) );
}
same but not in a c++ code
x(u, v) = (−90u^5 + 225u^4 − 270u^3 + 180u^2 − 45u) cos(Piv)
y(u, v) = 160u^4 − 320u^3 + 160u^2
z(u, v) = (−90u^5 + 225u^4 − 270u^3 + 180u^2 − 45u) sin(Piv)
where 0 <= u <= 1 and 0 <= v <= 1