您好,欢迎光临本网站![请登录][注册会员]  
文件名称: opengl20面体
  所属分类: C/C++
  开发工具:
  文件大小: 749byte
  下载次数: 0
  上传时间: 2012-04-14
  提 供 者: yang2*****
 详细说明: opengl 20面体#include #define X .525731112119133606 #define Z .850650808352039932 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,-X}, {Z,X,0.0},{-Z,X,0.0},{Z,-X,0.0},{-Z,-X,0.0}, }; static GLuint 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}, }; void display() { glCl ear(GL_COLOR_BUFFER_BIT); glBegin(GL_TRIANGLES); for(int i = 0;i < 20;++i) { glColor3f(1.0,1.0,i * 1.0 / 20);//颜色设置 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); } int main(int argc,char** argv) { glutInit(&argc;,argv); glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutInitWindowSize(250,250); glutInitWindowPosition(100,100); glutCreateWindow("Polygon"); init(); glutDisplayFunc(display); glutMainLoop(); return 0; } ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: opengl 20面体
 输入关键字,在本站1000多万海量源码库中尽情搜索: