我正在尝试生成多个五边形,但由于某种原因,五边形相互连接。有什么建议么?
GLfloat arr[] = {100,200,340,230,130,190,200,190,260,120,200};
glColor3f(1.0, 1.0, 1.0);
GLfloat angle2, r2, r_big_circle2, r_small_circle2, step2 = 3.14 / 5.0;
r_big_circle2 = 25;
r_small_circle2 = 20;
glPushMatrix();
glBegin(GL_LINE_LOOP);
for (int n = 0; n < 5; n++){
for (int i = 0; i < 10; i++)
{
r2 = (i % 2 == 0 ? r_small_circle2 : r_big_circle2);
angle2 = step2 * i;
glVertex3f(r2 * cos(angle2)-arr[n], r2 * sin(angle2)-arr[n], -500);
}
}
glEnd();
glPopMatrix();