Learn
Draw a circle:
const int n = 100 ; const float Pi = 3.1415926536f ; const float R = 0.5f ; // Draw a circle void DrawCircle() { // Draw a polygon 2Pi is 180° GLfloat tempVal = 2 * Pi / n; // Vertices need to be used between glBegin and glEnd // and glBegin specifies how to use these vertices glBegin(GL_POLYGON); for (size_t i = 0 ; i < n; ++ i) glVertex2f(R * cos(tempVal * i), R * sin(tempVal * i)); glEnd(); }
It can be used in Display().