Graphics
Download
1 / 21

Lab 5 - PowerPoint PPT Presentation


  • 113 Views
  • Uploaded on

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:

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Lab 5' - afya


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

Graphics

Lab 5



  • Transformation

    • Modeling ->translate (); rotate ();scale()

    • Viewing ->lookat() ;

    • Projection :

      • Perspective

      • Orthographic

  • Viewport

  • Clipping


Projections
Projections

  • There are two basic types of projections:

  • Perspective:

  • Orthographic = Parallel


Perspective
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


Zoom

  • Field of view: Smaller angle means more zoom


Opengl projection
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.


Orthographic projection
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


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


  • Viewport :

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



ad