1 / 21

Lab 5

Graphics. Lab 5. Transformation Viewport Clipping . Transformation Modeling -> translate (); rotate ();scale() Viewing -> lookat () ; Projection : Perspective Orthographic Viewport Clipping . Projections . There are two basic types of projections: Perspective:

afya
Download Presentation

Lab 5

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. Graphics Lab 5

  2. Transformation • Viewport • Clipping

  3. Transformation • Modeling ->translate (); rotate ();scale() • Viewing ->lookat() ; • Projection : • Perspective • Orthographic • Viewport • Clipping

  4. Projections • There are two basic types of projections: • Perspective: • Orthographic = Parallel

  5. Perspective: gluPerspective(fov_y, aspect_ratio, near, far) • fov_y is vertical field-of-view in degrees • aspect ratio = width / height • near, far are distances from eye to two clipping planes • must be positive

  6. Zoom • Field of view: Smaller angle means more zoom

  7. OpenGL Projection • For orthographic projection • For perspective projection • Window parameters are with respect to view position and orientation glMatrixMode(GL_PROJECTION); glOrtho(xwmin,xwmax,ywmin,ywmax,dnear,dfar); glMatrixMode(GL_PROJECTION); gluPerspective(theta,aspect,dnear,dfar); glMatrixMode(GL_MODELVIEW); gluLookAt(x0,y0,z0,xref,yref,zref,Vx,Vy,Vz); … other modelview transformations … *Note: dnear and dfar are the distances from camera position to near and far planes respectively. They should be positive.

  8. orthographic projection glOrtho(left, right, bottom, top, near, far) • left, right, bottom, top are coordinates in eye space • left, right are the x-coordinate limits • bottom, top are the y-coordinate limits • near, far are signed distances from the eye to the near and far

  9. Notes : when Zeye equal with zfar ,the object will be Disappearance

  10. Viewport : • EX: glViewport (0, 0, (GLsizei)width, (GLsizei)height);

  11. void keyboard (unsigned char key, int x, int y) • In the main : • glutKeyboardFunc(keyboard);

More Related