//semi-circle roof
//fix variable naming
int centerx = 400;//x axis center
int centery = 400;//y axis center
int roofr = 100;//radius
int roofd = 200;//diameter
float PI = 3.141592653589793238f;
float semicircleangle = PI * 1.0f;
int steps = 100;
glBegin(GL_TRIANGLE_FAN);
for (int i = 0; i < steps; i++) {
float theta = semicircleangle * float(i) / float(steps);//get the current angle
float x = roofr * cosf(theta);//calculate the x component
float y = roofr * sinf(theta);//calculate the y component
glVertex2f(x + centerx, y + centery);//output vertex
}
glEnd();