chapter 3: simple graphics program
DESCRIPTION
Chapter 3: Simple Graphics Program. We will learn. Review coordinate systems Simplest drawing program Graphics API drawing procedure Abstraction of drawing with graphics API. Take a photograph. Paper: cut to right size Position: place at right palce. Coordinate system. The origin - PowerPoint PPT PresentationTRANSCRIPT
Chapter 3
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
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 K. Sung, P. Shirley, S. Baer
Take a photograph
Paper: cut to right size Position: place at right palce
Chapter 3
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Coordinate system
The origin The X/Y Axes
Directions Units on axes
Chapter 3
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Paper: size and location
Chapter 3
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Vertex Positions
Order of specification: Va Vb Vc Vd
Clockwise vs Counterclockwise Either is ok, but consistent !
Choice of origin Convenience!
Chapter 3
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 K. Sung, P. Shirley, S. Baer
Tutorial 3.1: Frontend
Main application window and Drawing Window
Chapter 3
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
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
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
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
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
GrfxWindow: OnPaint() function
Drawing … 4 steps …
Chapter 3
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
GrfxWindow: Drawing …
Chapter 3
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
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
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 K. Sung, P. Shirley, S. Baer
Graphics objects: Circle
Center: (0,0) Radius: r If center at (xc,yc)
x = xc + r sin(θ) y = yc + r cos(θ)
Chapter 3
Essentials of Interactive Computer Graphics: Concepts and Implementation K. Sung, P. Shirley, S. Baer
Circle: implementation