- 論壇徽章:
- 0
|
源代碼如下:
void display(void) {
typedef Glfloat point2[2];
/* arbitrary triangle */
point2 vertices[3] = { {0.0,0.0}, {250.0,500.0}, {500.0,0.0} };
/* any desired initial point */
point2 p = { 75.0,75.0 };
for(int i=0; i<5000; i++) {
/* pick a random vertex from 0,1,2 */
int j=rand()%3;
/* compute new point */
p[0] = (p[0]+vertices[j][0])/2.0;
p[1] = (p[1]+vertices[j][1])/2.0;
/* display new point */
glBegin(GL_POINTS);
glVertex2fv(p);
glEnd();
}
glFlush();
}
目的就是用OPENGL畫(huà)一個(gè)Sierpinski Gasket圖形,好像就是一些三角形,可是編譯就是通不過(guò),不知道問(wèn)題在哪,哪位高人幫我試試,萬(wàn)分感謝。 |
|