(Sorry ! my english not very good)Does opengl smooth need some prerequisite
Recently I draw the earth on the computer but I find that my code can’t realize antialias.And I am sure that there must someting wrong in blow codes,but I do not know where the error.
this is my code :
//////////////////////////////////////////////////////////////
void DrawEarth(float radius,int h_slip,int l_slip)
{
//
float alpha_step = 2*PI/h_slip;
float beta_step = PI/l_slip;
float alpha = 0.0f;
float beta = PI;
//
float x = 0;
float y = 0;
float x_step = 1.0f/h_slip;
float y_step = 1.0f/l_slip;
int i;
int j;
for(i=0;i<l_slip;i++){
glBegin(GL_TRIANGLE_STRIP);
for(j=0;j<h_slip;j++)
{
}
glEnd();
}
glBegin(GL_QUADS);
for(i=0;i<l_slip;i++){
for(j=0;j<h_slip;j++)
{
glNormal3f(sin(beta)*cos(alpha),sin(beta)sin(alpha),cos(beta));
glTexCoord2f(x,y);
glVertex3f(radiussin(beta)cos(alpha),radiussin(beta)sin(alpha),radiuscos(beta));
alpha += alpha_step;
glTexCoord2f(x+x_step,y);
glVertex3f(radius*sin(beta)*cos(alpha),radius*sin(beta)*sin(alpha),radius*cos(beta));
beta -= beta_step;
glTexCoord2f(x+x_step,y+y_step);
glVertex3f(radius*sin(beta)*cos(alpha),radius*sin(beta)*sin(alpha),radius*cos(beta));
alpha -=alpha_step;
glTexCoord2f(x,y+y_step);
glVertex3f(radius*sin(beta)*cos(alpha),radius*sin(beta)*sin(alpha),radius*cos(beta));
beta += beta_step;
x += x_step;
alpha +=alpha_step;
}
x =0.0f;
y += y_step;
alpha = 0.0f;
beta -= beta_step;
}
glEnd();
}//endfunc
//////////////////////////////////////////////////////////////