1 / 16

OpenGL Viewing Pipeline

OpenGL Viewing Pipeline. Object coordinates. Modelview matrix. Eye coordinates. Projection matrix. Clip coordinates. Perspective division. Normalized device coordinates. Viewport transformation. Window coordinates. Object coordinates. Modeling matrix. Modelview Matrix.

tekli
Télécharger la présentation

OpenGL Viewing Pipeline

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. OpenGL Viewing Pipeline Object coordinates Modelview matrix Eye coordinates Projection matrix Clip coordinates Perspective division Normalized device coordinates Viewport transformation Window coordinates

  2. Object coordinates Modeling matrix Modelview Matrix World coordinates Viewing matrix Eye coordinates

  3. Viewing Transformation void gluLookAt( GLdouble x0, GLdouble y0, GLdouble z0, GLdouble x, GLdouble y, GLdouble z, GLdouble vx, GLdouble vy, GLdouble vz ) (x0, y0, z0): View Reference Point P0=(x0, y0, z0) (x, y, z): Look-at Point P=(x, y, z) (vx, vy, vz): View-up Vector V=(vx, vy, vz) y yv xv V zv P0 P x z

  4. Projection Transformations Orthographic Projection For orthographic projection, OpenGL assumes the view plane is placed at the near clipping plane. (xmax, ymax) View Volume yv Far Plane z = zf xv Near Plane z = zn (xmin, ymin) zv

  5. void glOrtho( GLdouble xmin, GLdouble xmax, GLdouble ymin,GLdouble ymax, GLdouble zn, GLdouble zf ) Transformation matrix for orthographic projection:

  6. Perspective Projection For perspective projection, OpenGL assumes the view plane is placed at the near clipping plane, and the projection reference point is at the eye coordinates origin. View Frustum (xmax, ymax) yv Far Plane z = zf xv Near Plane z = zn (xmin, ymin) zv

  7. void glFrustum( GLdouble xmin, GLdouble xmax, GLdouble ymin,GLdouble ymax, GLdouble zn, GLdouble zf ) Transformation matrix for perspective projection:

  8. Symmetric Perspective Projection View Frustum yv w h Far Plane z = zf xv  Near Plane z = zn zv Field of View (FOV) angle Aspect ratio r = w / h

  9. void gluPerspective(GLdouble , GLdouble r, GLdouble zn, GLdouble zf ) Transformation matrix for symmetric perspective projection:

  10. Viewport Transformation Program Window and Window Coordinates (Device Coordinates) yd Program Window Title Bar Menu Bar Tool Bar Client Area Border xd Status Bar

  11. Mapping View Volume to Viewport Orthographic Projection View Volume yv xv zv Viewport

  12. Perspective Projection View Frustum yv xv zv Viewport

  13. void glViewport(GLint x, GLint y, GLint width, GLint height) (x, y): Lower left corner of the Viewport in Window coordinates. width: Width of the Viewport, in pixels. height: Height of the Viewport, in pixels. yd Viewport height y xd x width

  14. Setting up 2D Viewing in OpenGL yv yd ymax Viewport Clipping Window ymin xmin xmax xv xd Viewing (Eye) Coordinates Device (Window) Coordinates void gluOrtho2D( GLdouble xmin, GLdouble xmax, GLdouble ymin, GLdouble ymax) Sets up projection matrix for 2D viewing. This is equivalent to glOrtho(xmin, xmax, ymin, ymax, -1.0, 1.0)

  15. Walking in a 3D Scene First Person Camera System U0 P: Camera Position F0: Initial Forward Direction U0: Initial Up Direction R0: Initial Right Direction F: Forward Direction U: Up Direction R: Right Direction U F R0 F0 R P

  16. U0 F0 T F  T R0  F0   R0 R P  R 0   360 90   90 Move forward: PP+aT Move backward: PPaT Move up: PP+aU0 Move down: PPaU0 Move left: PPaR Move right: PP+aR Turn left:      Turn right:    +  Look up:    +  Look down:     

More Related