1 / 27

Computer Graphics (fall 2009)

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

arlene
Download Presentation

Computer Graphics (fall 2009)

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. Computer Graphics(fall 2009) School of Computer Science University of Seoul

  2. 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 • Animating Interactive Programs • Design of Interactive Programs • Logic Operations

  3. 3.1 Interaction

  4. 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

  5. 3.2 Input Devices

  6. Physical Input Devices • Keyboard • Mouse, trackball, touchpad, pointing stick • Data tablet • Lightpen • Joystick • Spaceball • Data glove • Haptic device • Wiimote

  7. Logical Devices • String • Keyboard • Locator • Mouse • Pick • OpenGL “selection” • Choice • Discrete • Widgets (menu) • Valuators • Analog • Widgets (slidebar) • Stroke • Mouse motion

  8. Input Modes • Measure & trigger • Input modes • Request mode • Sample mode • Event mode • Event queue • Callback

  9. 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

  10. 3.3 Clients and Servers

  11. 3.4 Display Lists

  12. 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. (transformation, 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).

  13. 3.5 ProgrammingEvent-Driven Input

  14. Events • Notable GLUT events (http://www.opengl.org/resources/libraries/glut/spec3/node45.html) • glutDisplayFunc • glutReshapeFunc • glutKeyboardFunc • glutMouseFunc • glutMotionFunc • glutSpecialFunc • glutIdleFunc • glutPostRedisplay • glutTimeFunc

  15. 3.6 Menus

  16. Menus • Supported by GLUT • Hierarchical menu supported

  17. 3.7 Picking

  18. 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)

  19. Picking • Selection • By adjusting the clipping region and viewport • Using bounding boxes • AABB (Axis-aligned bounding box) • Back buffer + glReadPixels()

  20. 3.8 A Simple Paint Program

  21. 3.9 Building Interactive Models

  22. Building Interactive Models • Instancing • To keep the objects in the scene • Using structures or classes • Display list • For efficient rendering • No edition allowed

  23. 3.10 Animating Interactive Programs

  24. Double Buffering • To avoid flickering during animation • Created using GLUT_DOUBLE in glutInitDisplayMode() • Front/back buffers keep being switched using glutSwapBuffers() • When to change the parameters? • Idle event callback • Timer event callback

  25. 3.11 Design of Interactive Programs

  26. 3.12 Logic Operations

  27. Logic Operations • Logic operations can be applied to each pixel (source and destination) • XOR for erasable objects

More Related