slide1
Download
Skip this Video
Download Presentation
Lab 5

Loading in 2 Seconds...

play fullscreen
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
slide2
Transformation
  • Viewport
  • Clipping
slide3
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
slide7
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
slide17
Viewport :
  • EX: glViewport (0, 0, (GLsizei)width, (GLsizei)height);
slide21
void keyboard (unsigned char key, int x, int y)
  • In the main :
  • glutKeyboardFunc(keyboard);
ad