全文预览

计算机图形学-OpenGL纹理映射

上传者:蓝天 |  格式:doc  |  页数:4 |  大小:150KB

文档介绍
, -1.0f, 1.0f);Р glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f); Р glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);Р glEnd();РglEnd ( );РglDisable ( GL_TEXTURE_2D );Р?glPopMatrix();Р glFlush();Р?glDisable(GL_TEXTURE_2D);Р?glutSwapBuffers();Р}Рvoid reshape(int w, int h)Р{Р glViewport(0, 0, (GLsizei) w, (GLsizei) h);Р glMatrixMode(GL_PROJECTION);Р glLoadIdentity();Р glFrustum(-1.0,1.0,-1.0,1.0,3.0,9.0);Р glMatrixMode(GL_MODELVIEW);Р glLoadIdentity();Р}Рint main(int argc, char** argv)Р{Р glutInit(&argc,argv);Р glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH);Р glutInitWindowSize(500,500);Р glutInitWindowPosition(100,100);Р glutCreateWindow(argv[0]);Р init();Р glutDisplayFunc(display);Р?glutIdleFunc(display);Р glutReshapeFunc(reshape);Р glutMainLoop();Р return 0;Р}Р运行结果截图

收藏

分享

举报
下载此文档