3
我想生成多個五邊形,但由於某種原因五邊形彼此連接。有什麼建議麼?opengl多個五邊形
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();
謝謝你的工作很棒 – 2013-03-19 01:42:54