Essentials of Interactive Computer Graphics Concepts and Implementation

















- Slides: 17
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Chapter 3: Simple Graphics Program Chapter 3
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer We will learn n n Review coordinate systems Simplest drawing program Graphics API drawing procedure Abstraction of drawing with graphics API Chapter 3
Essentials of Interactive Computer Graphics: Concepts and Implementation Take a photograph n n Paper: cut to right size Position: place at right palce Chapter 3 K. Sung, P. Shirley, S. Baer
Essentials of Interactive Computer Graphics: Concepts and Implementation Coordinate system n n The origin The X/Y Axes n n Directions Units on axes Chapter 3 K. Sung, P. Shirley, S. Baer
Essentials of Interactive Computer Graphics: Concepts and Implementation Paper: size and location Chapter 3 K. Sung, P. Shirley, S. Baer
Essentials of Interactive Computer Graphics: Concepts and Implementation Vertex Positions n Order of specification: n n Va Vb Vc Vd Clockwise vs Counterclockwise Either is ok, but consistent ! Choice of origin n Convenience! Chapter 3 K. Sung, P. Shirley, S. Baer
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Tutorial 3. 1: Computer graphics solution Chapter 3
Essentials of Interactive Computer Graphics: Concepts and Implementation Tutorial 3. 1: Frontend n n Main application window and Drawing Window Chapter 3 K. Sung, P. Shirley, S. Baer
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Tutorial 3. 1: Backend programming n Main window (CTutorial. Dlg) n n Has an instance of drawing window At runtime: place the drawing window into the application window Chapter 3
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Tutorial 3. 1: Drawing Window n CGrfx. Window. D 3 D … n n n A MFC CWnd object Knows how to replace itself onto an application window Allows D 3 D drawing (On. Paint()) … Chapter 3
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Grfx. Window: On. Paint() function n Drawing … 4 steps … Chapter 3
Essentials of Interactive Computer Graphics: Concepts and Implementation Grfx. Window: Drawing … Chapter 3 K. Sung, P. Shirley, S. Baer
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Lesson learned: n Computer graphics: n n n Draws geometry: Render Must measure and design before coding Coordinate system n Choose a convenient system: n Origin, and units for measurement Chapter 3
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Graphics API independent drawing Chapter 3
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer Graphics objects: Rectangle Chapter 3
Essentials of Interactive Computer Graphics: Concepts and Implementation Graphics objects: Circle n n n Center: (0, 0) Radius: r If center at (xc, yc) n n x = xc + r sin(θ) y = yc + r cos(θ) Chapter 3 K. Sung, P. Shirley, S. Baer
Essentials of Interactive Computer Graphics: Concepts and Implementation Circle: implementation Chapter 3 K. Sung, P. Shirley, S. Baer