版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
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;/衛(wèi)星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);/ 設(shè)置地球公轉(zhuǎn)速度glRotatef(rot0,0.0,1.0,0.0);/ 設(shè)置地球半徑glTranslatef(5.0,0.0,0.0);/ 設(shè)置地球自轉(zhuǎn)速度/glRotatef(rot1,0.0,1.0,0.0);/ 繪制地球g
4、lutSolidSphere(0.4,32,32);/ 繪制地球的衛(wèi)星-月亮glColor3f(0.5,0.6,0.5);/ 抵消地球自轉(zhuǎn)影響/glRotatef(-rot1,0.0,1.0,0.0);/ 繪制輔助軌道glRotatef(90,1.0,0,0.0);glRotatef(-90,1.0,0,0.0);/ 設(shè)置月亮公轉(zhuǎn)速度glRotatef(rot9,0.0,1.0,0.0);/ 設(shè)置月亮公轉(zhuǎn)半徑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);/ 設(shè)置水星公轉(zhuǎn)速度glRotatef(rot1,0.0,1.0,0.0);/ 設(shè)置水星公轉(zhuǎn)半徑glTranslatef(2.5,0.0,0.0);/ 設(shè)置水星自傳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);/ 設(shè)置金星公轉(zhuǎn)速度glRotatef(rot2,0.0,3.0,0.0);/ 設(shè)置金星公轉(zhuǎn)半徑glTranslatef(3.4,0.0,0.0);/ 設(shè)置金星自傳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);/ 設(shè)置火星公轉(zhuǎn)速度glRotatef(rot3,0.0,4.0,0.0);/ 設(shè)置火星公轉(zhuǎn)半徑glTranslatef(6.6,0.0,0.0);/ 設(shè)置火星自傳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);/ 設(shè)置木星公轉(zhuǎn)速度glRotatef(rot4,0.0,0.4,0.0);/ 設(shè)置木星公轉(zhuǎn)半徑glTranslatef(8.5,0.0,0.0);/ 設(shè)置木星自傳glRotatef(rot3,0.0,0.3,0.0);/ 繪制木星glutSolidSphere(1.0,32,32);/ 繪制木星衛(wèi)星-木衛(wèi)1glColor3f(0.4,0.3,0.5);/ 抵消地球自轉(zhuǎn)影響/glRotatef(-rot1,0.0,1.0,0.0)
9、;/ 繪制輔助軌道glRotatef(90,1.0,0,0.0);glRotatef(-90,1.0,0,0.0);/ 設(shè)置木衛(wèi)1公轉(zhuǎn)速度glRotatef(rot10,0.0,1.0,0.0);/ 設(shè)置木衛(wèi)1公轉(zhuǎn)半徑glTranslatef(1.3,0.0,0.0);/ 繪制木衛(wèi)1glutSolidSphere(0.1,10,8);/ 繪制木星衛(wèi)星-木衛(wèi)2glColor3f(0.5f,0.5f,0.5f);/ 抵消地球自轉(zhuǎn)影響/glRotatef(-rot1,0.0,1.0,0.0);/ 繪制輔助軌道glRotatef(90,1.0,0,0.0);glRotatef(-90,1.0,0,0.
10、0);/ 設(shè)置木衛(wèi)2公轉(zhuǎn)速度glRotatef(rot11,0.0,1.0,0.0);/ 設(shè)置木衛(wèi)2公轉(zhuǎn)半徑glTranslatef(1.2,0.0,0.0);/ 繪制木衛(wèi)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);/ 設(shè)置土星公轉(zhuǎn)速度glRotatef(rot5,0.0,0.4,
11、0.0);/ 設(shè)置土星公轉(zhuǎn)半徑glTranslatef(12.5,0.0,0.0);/ 設(shè)置土星自傳glRotatef(rot3,0.0,0.3,0.0);/ 繪制土星glutSolidSphere(0.85,32,32);/繪制土星光環(huán)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);/ 設(shè)置天王星公轉(zhuǎn)速度glRotatef(rot6,0.0,0.4,0.0);/ 設(shè)置天王星公轉(zhuǎn)半徑glTranslatef(15.5,0.0,0.0);/ 設(shè)置天王星自傳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);/ 設(shè)置海王星公轉(zhuǎn)速度glRotatef(rot7,0.0,0.4,0.0);/ 設(shè)置海王星公轉(zhuǎn)半徑glTranslatef(17.5,0.0,0.0);/ 設(shè)置海王星自傳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);/ 設(shè)置冥王星公轉(zhuǎn)速度glRotatef(rot8,0.0,0.4,0.0);/ 設(shè)置冥王星公轉(zhuǎn)半徑glTranslatef(19.5,0.0,0.0);/ 設(shè)置冥王星自傳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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 貨車駕駛員崗前培訓(xùn)課件
- 2025-2030健身房連鎖經(jīng)營行業(yè)市場發(fā)展趨勢分析投資環(huán)境風(fēng)險評估合理規(guī)劃研究
- 鎖骨骨折患者睡眠護理
- 幼兒語言表達活動教案設(shè)計方案
- 電子商務(wù)法案例分析匯編
- 防火工程施工方案及安全措施
- 高血壓患者個性化健康指導(dǎo)方案
- 幼兒園音樂游戲教學(xué)案例分析
- 區(qū)域臨床技能培訓(xùn)教學(xué)資源標(biāo)準(zhǔn)化庫建設(shè)
- 廣播電視機務(wù)員7S考核試卷含答案
- 2024汽車舉升機保養(yǎng)合同范本
- 鋼材采購合同的范本
- 伯克利-利特溫(組織績效與變革因果關(guān)系)組織診斷+模型案例、工具解析
- 傳染病相關(guān)醫(yī)療設(shè)備與器械的操作與維護
- 2020-2021學(xué)年新概念英語第二冊-Lesson14-同步習(xí)題(含答案)
- 混凝土構(gòu)件的配筋計算
- 國家開放大學(xué)《政治學(xué)原理》章節(jié)自檢自測題參考答案
- GB/T 5758-2023離子交換樹脂粒度、有效粒徑和均一系數(shù)的測定方法
- 防雷裝置維護保養(yǎng)制度
- 中醫(yī)治療“膏淋”醫(yī)案67例
- 黃金冶煉行業(yè)三廢處理綜述
評論
0/150
提交評論