1 / 17

Simple Graphics Program

Learn about coordinate systems, drawing procedures, and the abstraction of drawing with graphics API. Explore paper size and location, vertex positions, and computer graphics solutions.

sjoanne
Download Presentation

Simple Graphics Program

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. Chapter 3: Simple Graphics Program Chapter 3

  2. We will learn • Review coordinate systems • Simplest drawing program • Graphics API drawing procedure • Abstraction of drawing with graphics API Chapter 3

  3. Take a photograph • Paper: cut to right size • Position: place at right palce Chapter 3

  4. Coordinate system • The origin • The X/Y Axes • Directions • Units on axes Chapter 3

  5. Paper: size and location Chapter 3

  6. Vertex Positions • Order of specification: • Va  Vb Vc Vd • Clockwise vs Counterclockwise • Either is ok, but consistent ! • Choice of origin • Convenience! Chapter 3

  7. Tutorial 3.1: Computer graphics solution Chapter 3

  8. Tutorial 3.1: Frontend • Main application window and • Drawing Window Chapter 3

  9. Tutorial 3.1: Backend programming • Main window (CTutorialDlg) • Has an instance of drawing window • At runtime: place the drawing window into the application window Chapter 3

  10. Tutorial 3.1: Drawing Window • CGrfxWindowD3D … • A MFC CWnd object • Knows how to replace itself onto an application window • Allows D3D drawing (OnPaint()) … Chapter 3

  11. GrfxWindow: OnPaint() function • Drawing … 4 steps … Chapter 3

  12. GrfxWindow: Drawing … Chapter 3

  13. Lesson learned: • Computer graphics: • Draws geometry: Render • Must measure and design before coding • Coordinate system • Choose a convenient system: • Origin, and units for measurement Chapter 3

  14. Graphics API independent drawing Chapter 3

  15. Graphics objects: Rectangle Chapter 3

  16. Graphics objects: Circle • Center: (0,0) • Radius: r • If center at (xc,yc) • x = xc + r sin(θ) • y = yc + r cos(θ) Chapter 3

  17. Circle: implementation Chapter 3

More Related