computer graphics (fall 2009)
DESCRIPTION
Computer Graphics (fall 2009). School of Computer Science University of Seoul. Chap 3: Input and Interaction. Interaction Input Devices Clients and Servers Display Lists Programming Event-Driven Input Menus Picking A Simple Paint Program Building Interactive Models - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Computer Graphics (fall 2009)](https://reader035.vdocuments.mx/reader035/viewer/2022062813/568164a7550346895dd69c6d/html5/thumbnails/1.jpg)
Computer Graphics(fall 2009)
School of Computer ScienceUniversity of Seoul
![Page 2: Computer Graphics (fall 2009)](https://reader035.vdocuments.mx/reader035/viewer/2022062813/568164a7550346895dd69c6d/html5/thumbnails/2.jpg)
Chap 3: Input and Interaction
1. Interaction2. Input Devices3. Clients and Servers4. Display Lists5. Programming Event-Driven Input6. Menus7. Picking8. A Simple Paint Program9. Building Interactive Models10. Animating Interactive Programs11. Design of Interactive Programs12. Logic Operations
![Page 3: Computer Graphics (fall 2009)](https://reader035.vdocuments.mx/reader035/viewer/2022062813/568164a7550346895dd69c6d/html5/thumbnails/3.jpg)
3.1 Interaction
![Page 4: Computer Graphics (fall 2009)](https://reader035.vdocuments.mx/reader035/viewer/2022062813/568164a7550346895dd69c6d/html5/thumbnails/4.jpg)
Sketchpad
Developed by Ivan Sutherland as part of his Ph.D thesis at MIT (1963).
Received the Turing Award in 1988. Ancestor of…
CAD GUI OOP HCI
Adopted lightpen as input device Demo on YouTube
![Page 5: Computer Graphics (fall 2009)](https://reader035.vdocuments.mx/reader035/viewer/2022062813/568164a7550346895dd69c6d/html5/thumbnails/5.jpg)
3.2 Input Devices
![Page 6: Computer Graphics (fall 2009)](https://reader035.vdocuments.mx/reader035/viewer/2022062813/568164a7550346895dd69c6d/html5/thumbnails/6.jpg)
Physical Input Devices
Keyboard Mouse, trackball, touchpad, pointing stick Data tablet Lightpen Joystick Spaceball Data glove Haptic device Wiimote
![Page 7: Computer Graphics (fall 2009)](https://reader035.vdocuments.mx/reader035/viewer/2022062813/568164a7550346895dd69c6d/html5/thumbnails/7.jpg)
Logical Devices
String Keyboard
Locator Mouse
Pick OpenGL “selection”
Choice Discrete Widgets (menu)
Valuators Analog Widgets (slidebar)
Stroke Mouse motion
![Page 8: Computer Graphics (fall 2009)](https://reader035.vdocuments.mx/reader035/viewer/2022062813/568164a7550346895dd69c6d/html5/thumbnails/8.jpg)
Input Modes
Measure & trigger Input modes
Request mode Sample mode Event mode
Event queueCallback
![Page 9: Computer Graphics (fall 2009)](https://reader035.vdocuments.mx/reader035/viewer/2022062813/568164a7550346895dd69c6d/html5/thumbnails/9.jpg)
GLUT (OpenGL Utility Toolkit) Again, no user interface features in OpenGL. UI should be implemented using other libraries, such as GLUT. GLUT supports (http://www.opengl.org/resources/libraries/glut)
Multiple windows for OpenGL rendering Callback driven event processing Sophisticated input devices An ‘idle’ routine and timers A simple, cascading pop-up menu facility Utility routines to generate various solid and wire frame objects Support for bitmap and stroke fonts Miscellaneous window management functions
![Page 10: Computer Graphics (fall 2009)](https://reader035.vdocuments.mx/reader035/viewer/2022062813/568164a7550346895dd69c6d/html5/thumbnails/10.jpg)
3.3 Clients and Servers
![Page 11: Computer Graphics (fall 2009)](https://reader035.vdocuments.mx/reader035/viewer/2022062813/568164a7550346895dd69c6d/html5/thumbnails/11.jpg)
3.4 Display Lists
![Page 12: Computer Graphics (fall 2009)](https://reader035.vdocuments.mx/reader035/viewer/2022062813/568164a7550346895dd69c6d/html5/thumbnails/12.jpg)
Display List
Groups multiple instructions into one to reduce the traffic between client & server.
Memory required on server side. Useful for text rendering. Care needed not to mess up the states. (transforma-
tion, projection, attributes, etc.) Can be saved/restored by push/pop.
Deprecated in OpenGL 3.0 Complex geometry can be stored in VBO (vertex buffer object).
![Page 13: Computer Graphics (fall 2009)](https://reader035.vdocuments.mx/reader035/viewer/2022062813/568164a7550346895dd69c6d/html5/thumbnails/13.jpg)
3.5 ProgrammingEvent-Driven Input
![Page 14: Computer Graphics (fall 2009)](https://reader035.vdocuments.mx/reader035/viewer/2022062813/568164a7550346895dd69c6d/html5/thumbnails/14.jpg)
Events Notable GLUT events (
http://www.opengl.org/resources/libraries/glut/spec3/node45.html) glutDisplayFunc glutReshapeFunc glutKeyboardFunc glutMouseFunc glutMotionFunc glutSpecialFunc glutIdleFunc
glutPostRedisplay glutTimeFunc
![Page 15: Computer Graphics (fall 2009)](https://reader035.vdocuments.mx/reader035/viewer/2022062813/568164a7550346895dd69c6d/html5/thumbnails/15.jpg)
3.6 Menus
![Page 16: Computer Graphics (fall 2009)](https://reader035.vdocuments.mx/reader035/viewer/2022062813/568164a7550346895dd69c6d/html5/thumbnails/16.jpg)
Menus
Supported by GLUT Hierarchical menu supported
![Page 17: Computer Graphics (fall 2009)](https://reader035.vdocuments.mx/reader035/viewer/2022062813/568164a7550346895dd69c6d/html5/thumbnails/17.jpg)
3.7 Picking
![Page 18: Computer Graphics (fall 2009)](https://reader035.vdocuments.mx/reader035/viewer/2022062813/568164a7550346895dd69c6d/html5/thumbnails/18.jpg)
OpenGL Picking
Can be implemented using selection mode (GL_SELECT) Deprecated in OpenGL 3.0
Can be implemented using occlusion query (http://www.opengl.org/registry/specs/ARB/occlusion_query.txt)
![Page 19: Computer Graphics (fall 2009)](https://reader035.vdocuments.mx/reader035/viewer/2022062813/568164a7550346895dd69c6d/html5/thumbnails/19.jpg)
Picking
Selection By adjusting the clipping region and viewport
Using bounding boxes AABB (Axis-aligned bounding box)
Back buffer + glReadPixels()
![Page 20: Computer Graphics (fall 2009)](https://reader035.vdocuments.mx/reader035/viewer/2022062813/568164a7550346895dd69c6d/html5/thumbnails/20.jpg)
3.8 A Simple Paint Program
![Page 21: Computer Graphics (fall 2009)](https://reader035.vdocuments.mx/reader035/viewer/2022062813/568164a7550346895dd69c6d/html5/thumbnails/21.jpg)
3.9 Building Interactive Mod-els
![Page 22: Computer Graphics (fall 2009)](https://reader035.vdocuments.mx/reader035/viewer/2022062813/568164a7550346895dd69c6d/html5/thumbnails/22.jpg)
Building Interactive Models
Instancing To keep the objects in the scene Using structures or classes
Display list For efficient rendering No edition allowed
![Page 23: Computer Graphics (fall 2009)](https://reader035.vdocuments.mx/reader035/viewer/2022062813/568164a7550346895dd69c6d/html5/thumbnails/23.jpg)
3.10 Animating Interactive Programs
![Page 24: Computer Graphics (fall 2009)](https://reader035.vdocuments.mx/reader035/viewer/2022062813/568164a7550346895dd69c6d/html5/thumbnails/24.jpg)
Double Buffering
To avoid flickering during animation Created using GLUT_DOUBLE in glu-tInitDisplayMode()
Front/back buffers keep being switched us-ing glutSwapBuffers()
When to change the parameters? Idle event callback Timer event callback
![Page 25: Computer Graphics (fall 2009)](https://reader035.vdocuments.mx/reader035/viewer/2022062813/568164a7550346895dd69c6d/html5/thumbnails/25.jpg)
3.11 Design of Interactive Programs
![Page 26: Computer Graphics (fall 2009)](https://reader035.vdocuments.mx/reader035/viewer/2022062813/568164a7550346895dd69c6d/html5/thumbnails/26.jpg)
3.12 Logic Operations
![Page 27: Computer Graphics (fall 2009)](https://reader035.vdocuments.mx/reader035/viewer/2022062813/568164a7550346895dd69c6d/html5/thumbnails/27.jpg)
Logic Operations
Logic operations can be applied to each pixel (source and destination)
XOR for erasable objects