




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、#include #include #include #include /行星GLfloat rot0 = 30.0;GLfloat rot1 = 0.0;GLfloat rot2 = 0.0;GLfloat rot3 = 0.0;GLfloat rot4 = 0.0;GLfloat rot5 = 0.0;GLfloat rot6 = 0.0;GLfloat rot7 = 0.0;GLfloat rot8 = 0.0;/卫星GLfloat rot9 = 0.0;GLfloat rot10 = 0.0;GLfloat rot11 = 0.0;void init()glClearColor(0.0
2、,0.0,0.0,0.0);glClearDepth(1.0);glShadeModel(GL_FLAT);void display()glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);glColor3f(1.0,1.0,1.0);glLoadIdentity();/gluLookAt(0, 10, 10, 0,0,0,0, 1,0);/glRotatef(45.0,0.0,0.0,1.0);glTranslatef(0.0,0.0,-20.0);glRotatef(90.0,1.0,0.0,0);glPushMatrix();/绘制太阳gl
3、Color3f(1.0,0.0,0.0);glutSolidSphere(2.0,32,32);/绘制地球glPushMatrix();glColor3f(0.0,0.0,1.0);/ 绘制辅助轨道glRotatef(90,1.0,0,0.0);glutSolidTorus(0.02, 5.0, 10, 64);glRotatef(-90,1.0,0,0.0);/ 设置地球公转速度glRotatef(rot0,0.0,1.0,0.0);/ 设置地球半径glTranslatef(5.0,0.0,0.0);/ 设置地球自转速度/glRotatef(rot1,0.0,1.0,0.0);/ 绘制地球g
4、lutSolidSphere(0.4,32,32);/ 绘制地球的卫星-月亮glColor3f(0.5,0.6,0.5);/ 抵消地球自转影响/glRotatef(-rot1,0.0,1.0,0.0);/ 绘制辅助轨道glRotatef(90,1.0,0,0.0);glRotatef(-90,1.0,0,0.0);/ 设置月亮公转速度glRotatef(rot9,0.0,1.0,0.0);/ 设置月亮公转半径glTranslatef(0.6,0.0,0.0);/ 绘制月亮glutSolidSphere(0.1,10,8);glPopMatrix();/ 绘制水星glPushMatrix();g
5、lColor3f(0.0,1.0,1.0);/ 绘制辅助轨道glRotatef(90,1.0,0,0.0);glutSolidTorus(0.02, 2.5, 10, 64);glRotatef(-90,1.0,0,0.0);/ 设置水星公转速度glRotatef(rot1,0.0,1.0,0.0);/ 设置水星公转半径glTranslatef(2.5,0.0,0.0);/ 设置水星自传glRotatef(rot3,0.0,1.0,0.0);/ 绘制水星glutSolidSphere(0.2,32,32);glPopMatrix();/绘制金星glPushMatrix();glColor3f(
6、0.0,1.0,0.0);/绘制辅助轨道glRotatef(90,1.0,0,0.0);glutSolidTorus(0.02, 3.4, 10, 64);glRotatef(-90,1.0,0,0.0);/ 设置金星公转速度glRotatef(rot2,0.0,3.0,0.0);/ 设置金星公转半径glTranslatef(3.4,0.0,0.0);/ 设置金星自传glRotatef(rot0,0.0,1.0,0.0);/ 绘制金星glutSolidSphere(0.3,32,32);glPopMatrix();/绘制火星glPushMatrix();glColor3f(1.0,0.0,0.
7、0);/绘制辅助轨道glRotatef(90,1.0,0,0.0);glutSolidTorus(0.02, 6.6, 10, 64);glRotatef(-90,1.0,0,0.0);/ 设置火星公转速度glRotatef(rot3,0.0,4.0,0.0);/ 设置火星公转半径glTranslatef(6.6,0.0,0.0);/ 设置火星自传glRotatef(rot7,0.0,2.0,0.0);/ 绘制火星glutSolidSphere(0.5,32,32);glPopMatrix();/绘制木星glPushMatrix();glColor3f(2.0,0.1,1.0);/绘制辅助轨道
8、glRotatef(90,1.0,0,0.0);glutSolidTorus(0.02, 8.5, 10, 64);glRotatef(-90,1.0,0,0.0);/ 设置木星公转速度glRotatef(rot4,0.0,0.4,0.0);/ 设置木星公转半径glTranslatef(8.5,0.0,0.0);/ 设置木星自传glRotatef(rot3,0.0,0.3,0.0);/ 绘制木星glutSolidSphere(1.0,32,32);/ 绘制木星卫星-木卫1glColor3f(0.4,0.3,0.5);/ 抵消地球自转影响/glRotatef(-rot1,0.0,1.0,0.0)
9、;/ 绘制辅助轨道glRotatef(90,1.0,0,0.0);glRotatef(-90,1.0,0,0.0);/ 设置木卫1公转速度glRotatef(rot10,0.0,1.0,0.0);/ 设置木卫1公转半径glTranslatef(1.3,0.0,0.0);/ 绘制木卫1glutSolidSphere(0.1,10,8);/ 绘制木星卫星-木卫2glColor3f(0.5f,0.5f,0.5f);/ 抵消地球自转影响/glRotatef(-rot1,0.0,1.0,0.0);/ 绘制辅助轨道glRotatef(90,1.0,0,0.0);glRotatef(-90,1.0,0,0.
10、0);/ 设置木卫2公转速度glRotatef(rot11,0.0,1.0,0.0);/ 设置木卫2公转半径glTranslatef(1.2,0.0,0.0);/ 绘制木卫2glutSolidSphere(0.08,10,8);glPopMatrix();/绘制土星glPushMatrix();glColor3f(1.0f, 1.0f, 0.0f);/绘制辅助轨道glRotatef(90,1.0,0,0.0);glutSolidTorus(0.02, 12.5, 10, 64);glRotatef(-90,1.0,0,0.0);/ 设置土星公转速度glRotatef(rot5,0.0,0.4,
11、0.0);/ 设置土星公转半径glTranslatef(12.5,0.0,0.0);/ 设置土星自传glRotatef(rot3,0.0,0.3,0.0);/ 绘制土星glutSolidSphere(0.85,32,32);/绘制土星光环glRotatef(90,1.0,0,0.0);glutSolidTorus(0.1, 1.25, 10, 64);glRotatef(-90,1.0,0,0.0);glRotatef(90,1.0,0,0.0);glutSolidTorus(0.07, 1.65, 10, 64);glRotatef(-90,1.0,0,0.0);glPopMatrix();
12、glPopMatrix();/绘制天王星glPushMatrix();glColor3f(0.0f, 1.0f, 1.0f);/绘制辅助轨道glRotatef(90,1.0,0,0.0);glutSolidTorus(0.02, 15.5, 10, 64);glRotatef(-90,1.0,0,0.0);/ 设置天王星公转速度glRotatef(rot6,0.0,0.4,0.0);/ 设置天王星公转半径glTranslatef(15.5,0.0,0.0);/ 设置天王星自传glRotatef(rot1,0.0,0.3,0.0);/ 绘制天王星glutSolidSphere(0.15,32,3
13、2);glPopMatrix();/绘制海王星glPushMatrix();glColor3f(0.0f, 0.0, 8.0f);/绘制辅助轨道glRotatef(90,1.0,0,0.0);glutSolidTorus(0.02, 17.5, 10, 64);glRotatef(-90,1.0,0,0.0);/ 设置海王星公转速度glRotatef(rot7,0.0,0.4,0.0);/ 设置海王星公转半径glTranslatef(17.5,0.0,0.0);/ 设置海王星自传glRotatef(rot3,0.0,0.3,0.0);/ 绘制海王星glutSolidSphere(0.145,3
14、2,32);glPopMatrix();/绘制冥王星glPushMatrix();glColor3f(0.5f, 0.5f, 0.5f);/绘制辅助轨道glRotatef(90,1.0,0,0.0);glutSolidTorus(0.02, 19.5, 10, 64);glRotatef(-90,1.0,0,0.0);/ 设置冥王星公转速度glRotatef(rot8,0.0,0.4,0.0);/ 设置冥王星公转半径glTranslatef(19.5,0.0,0.0);/ 设置冥王星自传glRotatef(rot2,0.0,0.3,0.0);/ 绘制冥王星glutSolidSphere(0.1
15、45,32,32);glPopMatrix();glutSwapBuffers();glFlush();void idle()rot0+=0.1;if(rot0=360.0)rot0-=360.0;rot1+=0.416;if(rot1=360.0)rot1-=360.0;rot2+=0.1631;if(rot2=360.0)rot2-=360.0;rot3+=0.053;if(rot3=360.0)rot3-=360.0;rot4+=0.0083;if(rot4=360.0)rot4-=360.0;rot5+=0.0034;if(rot5=360.0)rot5-=360.0;rot6+=0.
16、00119;if(rot6=360.0)rot6-=360.0;rot7+=0.00069;if(rot7=360.0)rot7-=360.0;rot8+=0.0008;if(rot8=360.0)rot8-=360.0;rot9+=1.0;if(rot9=360.0)rot9-=360.0;rot10+=0.005;if(rot10=360.0)rot10-=360.0;rot11+=0.01;if(rot11=360.0)rot11-=360.0;glutPostRedisplay();void reshape(int w,int h)glViewport(0,0,(GLsizei)w,(GLsizei)h);glMatrixMode(GL_PROJECTION);glLoadIdentity();gluPerspective(60.0,(GLdouble)w/(GLdouble)h,1.0,100.0);glMatrixMode(GL_MODELVIEW);void main(int argc,char *argv)glut
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 配电知识培训课件
- 配电基础知识培训
- 长沙医学院《高等数学Ⅰ(下)》2023-2024学年第一学期期末试卷
- 2025年陕西省商洛市洛南县重点名校初三下学期第一次月考试题化学试题试卷含解析
- 遵义师范学院《经典译著赏析》2023-2024学年第二学期期末试卷
- 德阳农业科技职业学院《国际新闻作品案例解析》2023-2024学年第二学期期末试卷
- 二甲护理条款解读
- 广西贵港市覃塘区重点名校2025年高中毕业班第二次模拟(英语试题文)试卷含答案
- 2025届山东省泰安一中、宁阳一中高三第四次月考(物理试题理)试题含解析
- 海南省琼海市嘉积中心校2024-2025学年三年级数学第二学期期末联考试题含解析
- 临时用电现场安全检查表
- 青少年模拟法庭剧本(敲诈勒索)
- 中考复习确定二次函数的解析式课件
- 音乐歌曲网上搜课件
- 万用表校准报告
- 地铁盾构法施工技术试题
- 直线导轨装配文档课件
- DBJ04∕T 253-2021 建筑工程施工安全管理标准
- 二元一次方程组(课堂PPT)
- Q∕GDW 12082-2021 输变电设备物联网无线传感器通用技术规范
- 医院药房考试试题及答案
评论
0/150
提交评论