Input and Interaction Lecture No. 4.

Slides:



Advertisements
Similar presentations
Better Interactive Programs
Advertisements

CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Graphics Pipeline.
Animation and Input CSCI Day Six. Animation Basic Steps to Draw Something: var vertices = [ … ]; var BufferId = gl.CreateBuffer(); gl.bindBuffer.
1 Computer Graphics Chapter 2 Input Devices. RM[2]-2 Input Devices Logical Input Devices  Categorized based on functional characteristics.  Each device.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Better Interactive Programs Ed Angel Professor of Computer Science, Electrical and Computer.
InteractionHofstra University1 Graphics Programming Input and Interaction.
Basic Input/Output Operations
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 What is Computer Graphics? Ed Angel Professor of Computer Science, Electrical and Computer.
Based on slides created by Edward Angel
Informationsteknologi Tuesday, November 6, 2007Computer Graphics - Class 41 Today’s class Input and interaction.
Group 5 Alain J. Percial Paula A. Ortiz Francis X. Ruiz.
Graphical Tree-Based Scientific Calculator: CalcuWiz Will Ryan Christian Braunlich.
Course Overview, Introduction to CG Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, September 5, 2003.
19/4/ :32 Graphics II Syllabus Selection and Picking Session 1.
CHAPTER 4 Window Creation and Control © 2008 Cengage Learning EMEA.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Chapter 3.   Interactive design of buildings,  Control of large systems through graphical interfaces,  Virtual-reality systems  Computer games. Applications.
CSC461 Lecture 11: Interactive Programs Contents and Objectives Picking Writing modes – XOR/Copy Rubberbanding Display list.
CGMB214: Introduction to Computer Graphics
CSC 461: Lecture 1 1 Lecture 1: Introduction Objectives Explore what computer graphics is about Survey some application areas Introduce a history of computer.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Principles of I/0 hardware.
Fundamentals of Computer Graphics Part 3 prof.ing.Václav Skala, CSc. University of West Bohemia Plzeň, Czech Republic ©2002 Prepared with Angel,E.: Interactive.
Lecture 5: Interaction 1  Principles of Interactive Graphics  CMSCD2012  Dr David England, Room 711,  ex 2271 
School of Computer Science University of Seoul. 1. Interaction 2. Input Devices 3. Clients and Servers 4. Display Lists 5. Programming Event-Driven Input.
Input and Interaction Chapter 3. CS 480/680 2Chapter 3 -- Input and Interaction Introduction: Introduction: We now turn to the development of interactive.
1Computer Graphics Input and Interaction Lecture 8 John Shearer Culture Lab – space 2
CAP 4703 Computer Graphic Methods Prof. Roy Levow Lecture 3.
1 Input and Interaction. 2 Input Devices Physical input devices Keyboard devices and pointing devices Logical input devices.
Computer Graphics I, Fall 2010 Input and Interaction.
Computer Graphics I, Fall : What is Computer Graphics?
Ch 2 Graphics Programming page 1 CSC 367 Coordinate Systems (2.1.2) Device coordinates, or screen coordinates (pixels) put limitations on programmers and.
Computing & Information Sciences Kansas State University Lecture 20 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 21 of 42 William H. Hsu.
CS 480/680 Computer Graphics Programming with Open GL Part 7: Input and Interaction Dr. Frederick C Harris, Jr. Fall 2011.
Dr. Ken Hoganson, Kennesaw State University Introduction to the Torque Game Development System.
1 Better Interactive Programs. 2 Objectives Learn to build more sophisticated interactive programs using ­Picking Select objects from the display Three.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
What is Computer Graphics?. 2 Objectives In this lecture, we explore what computer graphics is about We will give a historical introduction.
1 Angel and Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 What is Computer Graphics? Sai-Keung Wong ( 黃世強 ) Computer Science National.
X-WindowsP.K.K.Thambi The X Window System Module 5.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 What is Computer Graphics?
Program 2 due 02/01  Be sure to document your program  program level doc  your name  what the program does  each function  describe the arguments.
1 Input and Interaction. 2 Objectives Introduce the basic input devices ­Physical Devices ­Logical Devices ­Input Modes Event-driven input Introduce double.
Programming in the Simple Raster Graphics Package (SRGP) Chapter 2.
1 Graphics CSCI 343, Fall 2015 Lecture 6 Viewing, Animation, User Interface.
University of New Mexico
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Fall 2000M.B. Ibáñez Lecture 26 I/O Systems II. Fall 2000M.B. Ibáñez Application I/O Interface I/O system calls encapsulate device behaviors in generic.
Introduction to Input/Interaction Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, September 19, 2003.
An operating system (OS) is a collection of system programs that together control the operation of a computer system.
Graphics Programming. Graphics Functions We can think of the graphics system as a black box whose inputs are function calls from an application program;
COMP 175 | COMPUTER GRAPHICS Remco Chang1/XX13 – GLSL Lecture 13: OpenGL Shading Language (GLSL) COMP 175: Computer Graphics April 12, 2016.
Computer Graphics (Fall 2003) COMS 4160, Lecture 5: OpenGL 1 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
Computer Graphics Lecture 32
Better Interactive Programs
What is Computer Graphics?
CSC461 Lecture 8: Input Devices
What is Computer Graphics?
Introduction to Computer Graphics with WebGL
Advanced Menuing, Introduction to Picking
Display Lists & Text Glenn G. Chappell
Better Interactive Programs
Isaac Gang University of Mary Hardin-Baylor
Fundamentals of Computer Graphics Part 3
Input and Interaction Ed Angel
What is Computer Graphics?
University of New Mexico
Input and Interaction Ed Angel
Input and Interaction Ed Angel Professor Emeritus of Computer Science,
Presentation transcript:

Input and Interaction Lecture No. 4

Introduction Interactive computer graphics opens up a myriad of applications, ranging from interactive design of buildings, to control of large systems through graphical interfaces, to virtual-reality systems, to computer games.

Interaction One of the most important advances in computer technology was enabling users to interact with computer displays. Ivan Sutherland’s Project Sketchpad launched the present era of interactive computer graphics.

Interaction OpenGL does not support interaction directly. The major reason for this omission is that the system architects who designed OpenGL wanted to increase its portability by allowing the system to work in a variety of environment Windowing and input functions were left out of the Application Programming Interface (API.s).

Interaction We can avoid such potential difficulties by using a simple library, or toolkit. The toolkit can provide the minimal functionality, such as opening of windows, use of the keyboard and mouse, and creation of pop-up menus through the toolkit’s API.

Input Devices Physical vs. logical Physical Logical mouse, keyboard, etc. perspective of how they interact with system Logical function perspective of what they send to the application familiar to all writers of high-level programs

Input Devices For example, data input and output in C are done through functions such as printf, scanf, getchar, and putchar, whose arguments use the standard C data types, and through input (cin) and output (cout) streams in C++.

Input Devices In computer graphics, the use of logical devices is more complex , because the forms that input can take are more varied than the strings of bits or characters to which we are usually restricted in non-graphical applications.

Input Devices For example, we can use the mouse—a physical device— either to select a location on the screen, or to indicate which item in a menu we wish to select. In the first case, an x, y pair (in some coordinate system) is returned to the user program; in the second, the application program may receive an integer as the identifier of an entry in the menu.

Physical Input Devices Two categories: pointing devices: allows the user to indicate a position on the screen. keyboard devices: a physical keyboard, or generally, include any device that returns character codes to a program.

Physical Input Devices Absolute-positioning ( some fixed position) pen returns position (settable) data glove always returns 3D position coords Relative-positioning ( current position) mouse pos. always begins where cursor is

Measure and Trigger The manner by which physical and logical input devices provide input to an application program can be described in terms of two entities: a measure process: is what the device returns to the user program. a device trigger: is a physical input on the device with which the user can signal the computer.

Input modes Three distinct mode for a measure of a device. Each mode is defined by the relationship between the measure process and the trigger Request mode: the measure of the device is not returned to the program until the device is triggered. This input mode is standard in non graphical applications, such as a typical C program that requires character input.

The relationship between measure and trigger for Request mode Trigger Request Measure The relationship between measure and trigger for request mode Measure Process Program Trigger Process

Inputs modes Sample-mode: input is immediate , as soon as the function call in the user program is encountered, the measure is returned. No trigger is needed Measure Measure Process Program

Inputs modes In both request- and sample-mode the user must identify which device is to provide the input. We usually interface with the devices through functions such as request_locator(device_id, &measure); sample_locator(device_id, &measure);

Inputs modes Both request and sample modes are useful for situations where the program guides the user, but are not useful in applications where the user controls the flow of the program. For example , a flight simulator might have multiple input devices—such as a joystick, buttons, and switches. Sample- and request-mode input are not sufficient for handling the variety of possible human–computer interactions that arise in a modern computing environment.

Inputs modes Event mode: the most flexible input mode triggers generate events (events store data) measures are sent to 1) an event queue program checks queue events are examined and acted upon 2) a special-purpose function program associates function called a callback used with the major windowing systems because it has been proved to work well in client–server environments.

Event - Mode Model Trigger Measure A wait Event Trigger Process Program

Event-driven input Callback for display Callback for mouse glutDisplayFunc(display) Callback for mouse glutMouseFunc(mouse) Callback for keyboard glutKeyboardFunc(keyboard);

Clients and servers In OpenGL In general: Servers perform tasks for clients In OpenGL assumes the OpenGL program is the client assumes workstations are graphics servers that provide display and input services to the OpenGL program for example, the client can display its output on any networked server

Display lists Display list is a group of OpenGL commands that have been stored (compiled) for later execution. Once a display list is created, all vertex and pixel data are evaluated and copied into the display list memory on the server machine. It is only one time process. After the display list has been prepared (compiled), you can reuse it repeatedly without re-evaluating and re-transmitting data over and over again to draw each frame.

Display lists Display list is one of the fastest methods to draw static data because vertex data and OpenGL commands are cached in the display list and minimize data transmissions from the client to the server side. It means that it reduces CPU cycles to perform the actual data transfer. Another important capability of display list is that display list can be shared with many clients, since it is server state.

Display lists We can send graphical entities to a display in one of two ways: immediate mode: send the complete description of our objects (vertices, attributes, and primitive types )to the graphics server. No memory ,re-compute to redisplay.

Display lists retained-mode: define the object once, then put its description in a display list. The display list is stored in the server and redisplayed by a simple function call issued from the client to the server.

Display lists Advantage: reduced network traffic. allows the client to take advantage of any special-purpose graphics hardware that might be available in the graphics server. Disadvantage: require memory on the server. overhead of creating a display list.

Display lists Create multiple lists glGenLists(number) generates multiple lists glCallLists displays multiple lists

Menus GLUT provides pop-up menus, that we can use with the mouse to create sophisticated interactive applications. Using menus involve taking a few simple steps: - define entries -link menu to mouse button - define callback function for each menu entry

Picking Picking is the logical input operation that allows the user to identify an object on the display. Although the action of picking uses the pointing device, the information that the user wants returned to the application program is not a position. Old display processors could accomplish picking easily by means of a lightpen.

Picking One reason for the difficulty of picking in modern systems is the forward nature of their rendering pipelines. Primitives are defined in an application program and move forward through a sequence of transformations and clippers until they are rasterized into the frame buffer.

Picking three ways to deal with this difficulty: selection: involves adjusting the clipping region and viewport such that we can keep track of which primitives in a small clipping region are rendered into a region near the cursor. These primitives go into a hit list that can be examined later by the user program.

Picking bounding rectangles: or extents, for objects of interest. The extent of an object is the smallest rectangle, aligned with the coordinates axes, that contains the object. back buffer: Recall that the back buffer is not displayed and thus we can use it for purposes other than forming the image we will display when we swap the front and back buffers.

Buffering Single buffering Double buffering objects are always rendered into the same frame buffer, which is always being displayed delay of clearing of and re-drawing into frame-buffer will cause flicker if re-draw takes longer than refresh or refresh and animation not synced The higher the refresh rate, the less "flicker" you will see. Double buffering keep two buffers (front and back) always display front, always render into back* swap front and back when rendering complete