It should be of the form circle(float xcenter, float ycenter, float radius)
.
Using GL_TRIANGLE_FAN
plop down your center point and then your perimeter vertices:
void glCircle( float x, float y, float r, bool filled = true, unsigned int subdivs = 20 ) {
if( filled ) {
glBegin( GL_TRIANGLE_FAN );
glVertex2f( x, y );
} else {
glBegin( GL_LINE_STRIP );
}
for( unsigned int i = 0; i <= subdivs; ++i ) {
float angle = i * ((2.0f * 3.14159f) / subdivs);
glVertex2f( x + r * cos(angle), y + r * sin(angle) );
}
glEnd();
}