全文预览

电子科大实验2-三维图形程序设计

上传者:upcfxx |  格式:doc  |  页数:12 |  大小:269KB

文档介绍
{Р?glEnable(GL_DEPTH_TEST);Р?glClearColor(1.0,1.0,1.0,1.0);Р?glColor3f(0.0,0.0,0.0);Р}Рvoid mykey(unsigned char key,int x, int y)Р{Р?switch(key)Р?{Р?case '1':eyex+=1.0;break;Р?case '2':eyex-=1.0;break;Р?case '3':eyey+=1.0;break;Р?case '4':eyey-=1.0;break;Р?case '5':eyez+=1.0;break;Р?case '6':eyez-=1.0;break;Р?case '7':upx+=1.0;break;Р?case '8':upx-=1.0;break;Р?case '9':upy+=1.0;break;Р?case '0':upy-=1.0;break;Р?case 'q':upz+=1.0;break;Р?case 'w':upz-=1.0;Р?}Р?glutPostRedisplay();Р}Рvoid myReshape(int w, int h)Р{Р glViewport(w/2-W/2,h/2-H/2,W,H);Р?glMatrixMode(GL_PROJECTION);Р?glLoadIdentity();Р?gluPerspective(45.0,1.0,1.0,100.0);Р?glMatrixMode(GL_MODELVIEW);Р?glLoadIdentity();Р?gluLookAt(0.0,5.0,0.0, 0.0,0.0,0.0, 0.0,0.0,1.0);Р}РРvoid main(int argc,char **argv)Р{Р?glutInit(&argc,argv);

收藏

分享

举报
下载此文档