polygon approximation of a circle algorithm
This code does not print anything on the screen
(I mean the glVertex2i didn’t print when it was not commented),
it must depend on that the size of number : -rsin(2i*PI/seg) is like a 100 millions or so
But this is the formula I got
Do you know how to improve this code …?
Regards OGforever
//Draws a circle as approximation of linesegments
void polyCircle(int xc, int yc , int r, int seg)
{
int i, x, y ;
float xf, yf ;
glBegin(GL_POINTS) ;
glColor3f(0, 1.0, 0) ;
for(i = 0 ; i < seg ; i++)
{
glVertex2i(i, 24) ;
printf("Polypoly") ;
printf("printing x %d", -r*sin(2*i*PI/seg)) ;
/*
yf = r*cos(2*i*PI/seg) ;
glVertex2i(xc + (int)xf, yc - (int)yf) ;
*/
}
glEnd();
glFlush();
}