我什么时候才能吃上牛肉面啊~~敢问大牛们,当年也吃面?
这是一个不健全的程序,由于我伟大的VC经常罢工,这个程序调起来是那么的填堵,所以我就没继续调下去。这是书上画20面体的程序,然后我加了头和尾,当然是加错了,所以说不健全。贴上去,然后我就可以强行关掉VC了,以免丢失。
#define X .525731112119133606
#define Z .850650808352039932
#include<GL/glut.h>
void display()
{
static GLfloat vdata[12][3]={
{-X,0.0,Z},{X,0.0,Z},{-X,0.0,-Z},{X,0.0,-Z},
{0.0,Z,X},{0.0,Z,-X},{0.0,-Z,X},{0.0,-Z,-Z},
{Z,X,0.0},{-Z,X,0.0},{Z,-X,0.0},{-Z,-X,0.0}
};
static GLunit tindices[20][3]={
{1,4,0},{4,9,0},{4,5,9},{8,5,4},{1,8,4},
{1,10,8},{10,3,8},{8,3,5},{3,2,5},{3,7,2},
{3,10,7},{10,6,7},{6,11,7},{6,0,11},{6,1,0},
{10,1,6},{11,0,9},{2,11,9},{5,2,9},{11,2,7}
};
int i;
glBegin(GL_TRIANGLES);
for(i=0;i<20;i++)
{
glVertex3fv(&vdata[tindices[i][0]][0]);
glVertex3fv(&vdata[tindices[i][1]][0]);
glVertex3fv(&vdata[tindices[i][2]][0]);
}
glEnd();
glFlush();
}
void init()
{
glClearColor(0.0,0.0,0.0,0.0);
glShadeModel(GL_FLAT);
}
int main(int argc,char** argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_STINGLE|GLUT_RGB);
glutInitWindowSize(350,150);
glutCreatWindow(argv[0]);
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
posted on 2008-10-26 20:36
正牌的天地之灵和他的徒儿们肖赫_王婷婷_王冠_郑燚_孙婷 阅读(266)
评论(4) 编辑 收藏 引用 所属分类:
筱筱殿下