Assignment 2 Phase 1 - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

Assignment 2 Phase 1

Description:

Back-face culling. You can perform back-face culling in. World cord. View cord. ZN 0. Window cord. Clock wise. Back face. 1. 3. 2. View frustum culling ... – PowerPoint PPT presentation

Number of Views:82
Avg rating:3.0/5.0
Slides: 12
Provided by: Vic104
Category:

less

Transcript and Presenter's Notes

Title: Assignment 2 Phase 1


1
Assignment 2 Phase 1
  • Transformation
  • Back-face culling
  • View frustum culling

2
Outline
  • Implement the transformation.
  • Viewing transformation
  • Projection transformation
  • Perspective division
  • Viewport transformaion
  • Implement back-face culling.
  • Implement view frustum culling.

3
Input and Output
  • Input .view .obj .mtl
  • Same as assignment 1
  • Output Wireframe of the obj with back-face
    culling

4
Transformation 1/3
Modelview Matrix
Viewport Transformation
Projection Matrix
Perspective Division
Vertex
  • Viewing transformaion
  • Tview B T
  • Implement gluLookat() in OpenGL

5
Transformation 2/3
  • Projection transformation
  • Tp NSH
  • Implement gluPerspective() in OpenGL, so do not
    need to implement H

6
Transformation 3/3
  • Perspective division
  • All X,Y,Z,W are divided by W.
  • Viewport transformation
  • Tv T S

7
Back-face culling
  • You can perform back-face culling in
  • World cord.
  • View cord.
  • ZN lt 0
  • Window cord.
  • Clock wise

1
Back face
3
2
8
View frustum culling
  • eliminate the polygon that complete outside the
    view frustum.
  • Bonus view frustum clipping
  • Remove the part of polygon that outside the view
    frustum.

9
How to draw wireframe?
  • Render the image using
  • glBegin(GL_LINE_LOOP)
  • glVertex2i(x,y)
  • glEnd()

10
What to do in reshape function?
  • void GL_reshape(GLsizei w, GLsizei h)
  • glViewport(viewport-gtx, viewport-gty,
  • viewport-gtwidth,
    viewport-gtheight)
  • glMatrixMode(GL_PROJECTION)
  • glLoadIdentity()
  • gluOrtho2D(viewport-gtx, viewport-gtwidth,
  • viewport-gty,
    viewport-gtheight)
  • glMatrixMode(GL_MODELVIEW)
  • glLoadIdentity()

11
UI requirement
  • Show an input command line.
  • Please input the file name.
  • If I type box, then read box.obj and box.view
    etc.
Write a Comment
User Comments (0)
About PowerShow.com