I want draw a sphere using for loop (I want to draw a sphere instead of circle please help)
void drawCircle(double x, double y, double r)
{
glColor3f(nodeBGClolor.r, nodeBGClolor.g, nodeBGClolor.b);
int iterations = 500;
glBegin(GL_POLYGON);
for (int i = 0; i < iterations; i++)
{
double currX = r * cos(2 * PI * (i / (iterations * 1.0)));
double currY = r * sin(2 * PI * (i / (iterations * 1.0)));
glVertex2f(x + currX, y + currY);
}
glEnd();
}