1 / 16

投影 / 視角相關

投影 / 視角相關. 投影轉換的目的. 做投影轉換的目的 定義視覺範圍 (Viewing volume) 視覺範圍可以決定物體如何投影在螢幕上 ( 透視投影或正交投影 ). 投影的作法. 1. 正交投影 glOrtho() 及 gluOrtho2D() 的函式 正交投影的視覺範圍則是平行六面體 近端截取平面與遠端截取平面是一樣大的 物體與觀察點距離的 遠近 並不會影響其顯示的大小. glOrtho 正交投影.

ewa
Download Presentation

投影 / 視角相關

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 投影/視角相關

  2. 投影轉換的目的 • 做投影轉換的目的 • 定義視覺範圍(Viewing volume) • 視覺範圍可以決定物體如何投影在螢幕上(透視投影或正交投影)

  3. 投影的作法 • 1.正交投影 • glOrtho()及gluOrtho2D()的函式 • 正交投影的視覺範圍則是平行六面體 • 近端截取平面與遠端截取平面是一樣大的 • 物體與觀察點距離的遠近並不會影響其顯示的大小

  4. glOrtho 正交投影 • void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far) • 參數: • (left,bottom,-near)和(right,top,-near)分別表示近端截取平面左下與右上的點 • (left,bottom,-far)和(right,top,-far)則是指出遠端截取平面的範圍。

  5. glOrtho

  6. 透視投影 • 2.透視投影 • glFrustum()及gluPerspective() • 近端截取平面與遠端截取平面並不一樣大,代表物體會隨著與觀察點的距離而改變大小

  7. gluPerspective • void gluPerspective • (GLdouble fovy, GLdouoble aspect, GLdouble near, GLdouble far) • 參數: • fovy:投影凹度, 其值介於0與180之間。 • aspect:投影外觀比,(double) w/h • near:投影近點,由觀看者至截頭體近端截取平面的距離。 • far:投影遠點,由觀看者至截頭體遠端截取平面的距離。 • 由於near與far之值代表觀看者與近端及遠端截取平面的距離,所以其值為正。

  8. gluPerspective

  9. gluPerspective

  10. glViewport • glViewport(GLint x, GLint y, GLsizei width, GLsizei height) • 說明:影像映射到視窗上的範圍 • 參數: • x,y:(x,y)參數指定了長方形左下角的位置。 • width和height:可視範圍的長與寬。 • 預設為(0,0,winWidth,winHeight) • 其中winWidth和winHeight分別是視窗的大小。當然,若是參數值設定不適當,可能會導致影像失真(如上圖)。

  11. (x,y) (50,50) (x,y)

  12. width和height

  13. 圖片解說

  14. gluLookAt • voidgluLookAt(eyex,center,Up) • 用來設定視野的函式 • 設定 觀察點的座標及你要看的座標 • 參數: • Eyex: 設定眼睛的位置 • Center:眼睛所要看的方向座標點 • Up:觀察者視角指向上方的向量 • (0,1,0) y , (1,0,0) x ,(0,0,1) z

  15. 目標 • Surface rendering • shadows

More Related