- 论坛徽章:
- 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画一个Sierpinski Gasket图形,好像就是一些三角形,可是编译就是通不过,不知道问题在哪,哪位高人帮我试试,万分感谢。 |
|