計(jì)算機(jī)圖形圖像繪制技術(shù).ppt_第1頁
計(jì)算機(jī)圖形圖像繪制技術(shù).ppt_第2頁
計(jì)算機(jī)圖形圖像繪制技術(shù).ppt_第3頁
計(jì)算機(jī)圖形圖像繪制技術(shù).ppt_第4頁
計(jì)算機(jī)圖形圖像繪制技術(shù).ppt_第5頁
已閱讀5頁,還剩44頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、計(jì)算機(jī)圖形圖像繪制技術(shù),第二講,主要內(nèi)容,顯示三維坐標(biāo)的程序(1) 幾何對(duì)象的變換 變換矩陣 平移glTranslatef 旋轉(zhuǎn)glRotatef 縮放glScalef 三維實(shí)體 顯示三維坐標(biāo)的程序(2) 顏色 點(diǎn)與線的屬性 面的顯示 隱藏面與深度緩沖 多邊形面的方向 顯示模式 練習(xí),顯示三維坐標(biāo)的程序(1),變換矩陣,在OpenGL中使用矩陣進(jìn)行渲染三維場(chǎng)景所需要的數(shù)據(jù)計(jì)算 為簡(jiǎn)化操作,OpenGL提供一個(gè)矩陣棧,每次用棧頂?shù)木仃噷?duì)給定的物體或場(chǎng)景進(jìn)行渲染 用glPushMatrix和glPopMatrix函數(shù)來將矩陣壓棧和出棧,還可以用glScalef和glRotatef等函數(shù)對(duì)棧頂?shù)木仃?/p>

2、進(jìn)行縮放和旋轉(zhuǎn)等修改,Push / Pop Matrix,void glPushMatrix(void);,Push / Pop Matrix,void glPopMatrix(void);,Example,glPushMatrix(); glTranslatef(.); glRotatef(.); glScalef(.); glutSolidCylinder(.); glPopMatrix();,平移glTranslatef,void glTranslated (GLdouble x, GLdouble y, GLdouble z); void glTranslatef (GLfloat x

3、, GLfloat y, GLfloat z); 演示,旋轉(zhuǎn)glRotatef,void glRotated (GLdouble angle, GLdouble x, GLdouble y, GLdouble z); void glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z); 演示,縮放glScalef,void glScaled (GLdouble x, GLdouble y, GLdouble z); void glScalef (GLfloat x, GLfloat y, GLfloat z); 演示,Example,

4、glLoadIdentity(); glPushMatrix(); glTranslatef (); glPushMatrix(); glLoadIdentity(); glTranslate (); glPopMatrix(); glPushMatrix(); glRotatef (); glPopMatrix(); glPopMatrix();,Example,glLoadIdentity(); glPushMatrix(); glTranslatef (); glPushMatrix(); glLoadIdentity(); glTranslate (); glPopMatrix();

5、glPushMatrix(); glRotatef (); glPopMatrix(); glPopMatrix();,Identity,Example,glLoadIdentity(); glPushMatrix(); glTranslatef (); glPushMatrix(); glLoadIdentity(); glTranslate (); glPopMatrix(); glPushMatrix(); glRotatef (); glPopMatrix(); glPopMatrix();,Identity,Example,glLoadIdentity(); glPushMatrix

6、(); glTranslatef (); glPushMatrix(); glLoadIdentity(); glTranslate (); glPopMatrix(); glPushMatrix(); glRotatef (); glPopMatrix(); glPopMatrix();,Identity,Translate,Example,glLoadIdentity(); glPushMatrix(); glTranslatef (); glPushMatrix(); glLoadIdentity(); glTranslate (); glPopMatrix(); glPushMatri

7、x(); glRotatef (); glPopMatrix(); glPopMatrix();,Identity,Translate,Example,glLoadIdentity(); glPushMatrix(); glTranslatef (); glPushMatrix(); glLoadIdentity(); glTranslate (); glPopMatrix(); glPushMatrix(); glRotatef (); glPopMatrix(); glPopMatrix();,Identity,Translate,Identity,Example,glLoadIdenti

8、ty(); glPushMatrix(); glTranslatef (); glPushMatrix(); glLoadIdentity(); glTranslate (); glPopMatrix(); glPushMatrix(); glRotatef (); glPopMatrix(); glPopMatrix();,Identity,Translate,Identity,Translate,Example,glLoadIdentity(); glPushMatrix(); glTranslatef (); glPushMatrix(); glLoadIdentity(); glTra

9、nslate (); glPopMatrix(); glPushMatrix(); glRotatef (); glPopMatrix(); glPopMatrix();,Identity,Translate,Example,glLoadIdentity(); glPushMatrix(); glTranslatef (); glPushMatrix(); glLoadIdentity(); glTranslate (); glPopMatrix(); glPushMatrix(); glRotatef (); glPopMatrix(); glPopMatrix();,Identity,Tr

10、anslate,Example,glLoadIdentity(); glPushMatrix(); glTranslatef (); glPushMatrix(); glLoadIdentity(); glTranslate (); glPopMatrix(); glPushMatrix(); glRotatef (); glPopMatrix(); glPopMatrix();,Identity,Translate,Rotate,Example,glLoadIdentity(); glPushMatrix(); glTranslatef (); glPushMatrix(); glLoadI

11、dentity(); glTranslate (); glPopMatrix(); glPushMatrix(); glRotatef (); glPopMatrix(); glPopMatrix();,Identity,Translate,Example,glLoadIdentity(); glPushMatrix(); glTranslatef (); glPushMatrix(); glLoadIdentity(); glTranslate (); glPopMatrix(); glPushMatrix(); glRotatef (); glPopMatrix(); glPopMatri

12、x();,Identity,平移與旋轉(zhuǎn)的次序很重要,glLoadIdentity() glRotated(45, 0, 0, 1) glTranslated(5, 0, 0),OpenGL commands successively define new “l(fā)ocal” coordinate spaces in terms of the “current” or previous local space.,三維實(shí)體對(duì)象,Glaux.lib庫 void auxWireSphere(GLdouble); void auxSolidSphere(GLdouble); void auxWireCube

13、(GLdouble); void auxSolidCube(GLdouble); void auxWireBox(GLdouble, GLdouble, GLdouble); void auxSolidBox(GLdouble, GLdouble, GLdouble); void auxWireTorus(GLdouble, GLdouble); void auxSolidTorus(GLdouble, GLdouble); void auxWireCylinder(GLdouble, GLdouble); void auxSolidCylinder(GLdouble, GLdouble);

14、void auxWireIcosahedron(GLdouble); void auxSolidIcosahedron(GLdouble); void auxWireOctahedron(GLdouble); void auxSolidOctahedron(GLdouble); void auxWireTetrahedron(GLdouble); void auxSolidTetrahedron(GLdouble); void auxWireDodecahedron(GLdouble); void auxSolidDodecahedron(GLdouble); void auxWireCone

15、(GLdouble, GLdouble); void auxSolidCone(GLdouble, GLdouble); void auxWireTeapot(GLdouble); void auxSolidTeapot(GLdouble);,球,立方體,長(zhǎng)方體,圓環(huán),圓柱,二十面體,八面體,四面體,十二面體,圓錐,茶壺,Glut庫 void glutWireSphere(GLdouble radius, GLint slices, GLint stacks); void glutSolidSphere(GLdouble radius, GLint slices, GLint stacks);

16、 void glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks); void glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks); void glutWireCube(GLdouble size); void glutSolidCube(GLdouble size); void glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint si

17、des, GLint rings); void glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings); void glutWireDodecahedron(void); void glutSolidDodecahedron(void); void glutWireTeapot(GLdouble size); void glutSolidTeapot(GLdouble size); void glutWireOctahedron(void); void glutSolidOctah

18、edron(void); void glutWireTetrahedron(void); void glutSolidTetrahedron(void); void glutWireIcosahedron(void); void glutSolidIcosahedron(void);,顯示三維坐標(biāo)的程序(2),(演示),顏色,glColor3fv(face color) render_face() glColor3fv(eye color) render_eyes() glColor3fv(hair color) render_hair() glColor3fv(teeth color) re

19、nder_teeth(),Colors,顏色其有四個(gè)分量: R- 紅 Red. G- 綠 Green. B- 藍(lán) Blue. A- 透明度 Transparent.,glShadeModel(GL_FLAT); glBegin(GL_QUADS); glColor3f (1.0,0.0,0.0); glVertex3f(0.0,0.0,0.0); glColor3f (0.0,1.0,0.0); glVertex3f(1.0,0.0,0.0); glColor3f (0.0,0.0,1.0); glVertex3f(1.0,1.0,0.0); glColor3f (1.0,1.0,0.0); glVertex3f(0.0,1.0,0.0); glEnd();,Shading Models,glShadeModel(GL_SMOOTH); glBegin(GL_QUADS); glColor3f (1.0,0.0,0.0); glVertex3f(0.0,0.0,0.0); glColor3f (0.0,1.0,0.0); glVertex3f(1.0,0.0

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論