Input and Interaction. Project Sketchpad. Graphical Input. Physical Devices. Objectives



Similar documents
Input and Interaction

Input and Interaction. CS 432 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Input and Interaction. Objectives

The mouse callback. Positioning. Working with Callbacks. Obtaining the window size. Objectives

OpenGL & Delphi. Max Kleiner. 1/22

CMSC 427 Computer Graphics 1

Graphics Input Primitives. 5. Input Devices Introduction to OpenGL. String Choice/Selection Valuator

An Introduction to. Graphics Programming

CMSC 427 Computer Graphics 1

Computer Graphics. Computer graphics deals with all aspects of creating images with a computer

Computer Graphics (Basic OpenGL, Input and Interaction)

Computer Graphics Labs

CS 378: Computer Game Technology

The Keyboard One of the first peripherals to be used with a computer and is still the primary input device for text and numbers.

Keyboard Mouse and Menus

SYMETRIX SOLUTIONS: TECH TIP August 2015

Interactive Whiteboard Functionality Overview Choosing Pen Style Erasing / Modifying Writing Undo / Redo

Flash MX 2004 Animation Lesson

Blender Notes. Introduction to Digital Modelling and Animation in Design Blender Tutorial - week 9 The Game Engine

Interaction: Mouse and Keyboard DECO1012

13-1. This chapter explains how to use different objects.

Asset Track Getting Started Guide. An Introduction to Asset Track

Below is a diagram explaining the data packet and the timing related to the mouse clock while receiving a byte from the PS-2 mouse:

Computer Graphics Labs

#include <Gamer.h> Gamer gamer; void setup() { gamer.begin(); } void loop() {

CMSC 425 Game Programming 1

Lecture Notes, CEng 477

CS130 - Intro to computer graphics. Dr. Victor B. Zordan vbz@cs.ucr.edu Objectives

ChemPad3. a tutorial. Ben Shine and Dana Tenneson. May 21, 2008

2: Introducing image synthesis. Some orientation how did we get here? Graphics system architecture Overview of OpenGL / GLU / GLUT

Lesson 10: Video-Out Interface

Gursharan Singh Tatla Page No. 1 COMPUTER GRAPHICS (Short Answer type Questions)

Chapter 5 Understanding Input. Discovering Computers Your Interactive Guide to the Digital World

Canterbury Maps Quick Start - Drawing and Printing Tools

Tutorial: Get Running with Amos Graphics

Working With Animation: Introduction to Flash

Help. Contents Back >>

Implementação. Interfaces Pessoa Máquina 2010/ Salvador Abreu baseado em material Alan Dix. Thursday, June 2, 2011

Lesson 4. Temporal Management of Layers

Tutorial: Get Running with Amos Graphics

REFERENCE GUIDE 1. INTRODUCTION

Graphics Pipeline in a Nutshell

Quick installation guide for the Vista Quantum QNVR Network Video Recorder

ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER

AD201, STC106, STC109, STC204, STC302, STC304, STC309, STC311

Computer Science 217

X Series Application Note 43:

Introduction to Computer Graphics

Chapter 9 Slide Shows

File Management and File Storage

Management Challenge. Managing Hardware Assets. Central Processing Unit. What is a Computer System?

While Loops and Animations

Introduction. Chapter 1

What makes a good coder and technology user at Mountfields Lodge School?

A Novel Multitouch Interface for 3D Object Manipulation

The CAD interface is comprised of two different screens: the graphic/drawing screen and the text screen.

Chapter 3 Input Devices

Click to view Web Link, click Chapter 8, Click Web Link from left navigation, then click BIOS below Chapter 8 p. 395 Fig. 8-4.

Lecture 3: Coordinate Systems and Transformations

Video Tracking Software User s Manual. Version 1.0

SMART Board Software for Macintosh FAQ

Table of Contents GETTING STARTED Enter Password Dialog...3 Using Online Help...3 System Configuration Menu...4

PIC 10A. Lecture 7: Graphics II and intro to the if statement

PM1122 INT DIGITAL INTERFACE REMOTE

SB101 SMART Board 101

The SMART Board Interactive Whiteboard

SMART Boards. If the board is connected to a different computer - Orientation is needed whenever you connect it to a new or different computer.

Windows PowerShell Essentials

Sources: On the Web: Slides will be available on:

User manual DMX CONTROL 512. Table of contents

Message Display and Message Archiving 1/2

Freescale Semiconductor, I

This is simple but it does involve a reboot so be sure to save and close any work first. Then run R:\Public\CS\Enable Remote Desktop

PN-L702B LCD MONITOR TOUCH PANEL DRIVER OPERATION MANUAL. Version 2.1

Tutorial: Biped Character in 3D Studio Max 7, Easy Animation

USER MANUAL GUIMGR Graphical User Interface Manager for FRM301/FRM401 Media Racks

FLASH. Mac versus PC. Pixels versus Vectors Two kinds of images are in the digital world: bitmaps and vectors:

Anime Studio Debut 10 Create Your Own Cartoons & Animations!

UM0853 User manual. 1 Introduction. M24LRxx application software user guide

Intel Extreme Graphics 2 User s Guide for Version 14.x Driver Releases

1. Application of Computer Graphics

Creating a 2D Game Engine for Android OS. Introduction

SMART Board Interactive Whiteboard Basics Tip Sheet for ABP Faculty

4D Interactive Model Animations

Universal Simple Control, USC-1

Graphic Objects and Loading Them into TGF2/MMF2

Understand the Sketcher workbench of CATIA V5.

Chapter 8 Operating Systems and Utility Programs

Synthesys Call Recycling

As you look at an imac you will notice that there are no buttons on the front of the machine as shown in figure 1.

The C Programming Language course syllabus associate level

Ready Light on lowerright of frame bezel

GUI Event-Driven Programming

Software User s Guide - ArizonaSun

Gauge Drawing Tool Slider Drawing Tool Toggle Button Drawing Tool One-Way List Drawing Tool... 8

TUTORIAL FOR INITIALIZING BLUETOOTH COMMUNICATION BETWEEN ANDROID AND ARDUINO

Contents. Operations from the PC (via Network) 23. Projector Functions 3

Quick Start Guide. Microsoft OneNote 2013 looks different from previous versions, so we created this guide to help you minimize the learning curve.

Transcription:

Input and Interaction Project Sketchpad Objectives Introduce the basic input devices - Physical Devices - Logical Devices - Input Modes Event-driven input Introduce double buffering for smooth animations Programming event input with GLUT Ivan Sutherland (MIT 1963) established the basic interactive paradigm that characterizes interactive computer graphics: - User sees an object on the display - User points to (picks) the object with an input device (light pen, mouse, trackball) - Object changes (moves, rotates, morphs) - Repeat 1 2 Graphical Input Physical Devices Devices can be described either by - Physical properties Mouse Keyboard Trackball - Logical Properties What is returned to program via API A position An object identifier Modes - How and when input is obtained Request or event mouse trackball light pen data tablet joy stick space ball 3 4 1

Incremental (Relative) Devices Devices such as the data tablet return a position directly to the operating system Devices such as the mouse, trackball, and joy stick return incremental inputs (or velocities) to the operating system - Must integrate these inputs to obtain an absolute position Rotation of cylinders in mouse Roll of trackball Difficult to obtain absolute position Can get variable sensitivity Logical Devices Consider the C and C++ code - C++: cin >> x; -C: scanf ( %d, &x); What is the input device? - Can t tell from the code - Could be keyboard, file, output from another program The code provides logical input - A number (an int) is returned to the program regardless of the physical device 5 6 Graphical Logical Devices X Window Input for OpenGL Graphical input is more varied than input to standard programs which is usually numbers, characters, or bits Two older APIs (GKS, PHIGS) defined six types of logical input - Locator: return a position - Pick: return ID of an object - Keyboard: return strings of characters - Stroke: return array of positions - Valuator: return floating point number - Choice: return one of n items The X Window System introduced a client-server model for a network of workstations - Client: OpenGL program - Graphics Server: bitmap display with a pointing device and a keyboard 7 8 2

Input Modes Input devices contain a trigger which can be used to send a signal to the operating system - Button on mouse - Pressing or releasing a key When triggered, input devices return information (their measure) to the system - Mouse returns position information - Keyboard returns ASCII code Request Mode Input provided to program only when user triggers the device Typical of keyboard input - Can erase (backspace), edit, correct until enter (return) key (the trigger) is depressed 9 10 Event Mode Event Types Most systems have more than one input device, each of which can be triggered at an arbitrary time by a user Each trigger generates an event whose measure is put in an event queue which can be examined by the user program Window: resize, expose, iconify Mouse: click one or more buttons Motion: move mouse Keyboard: press or release a key Idle: nonevent - Define what should be done if no other event is in queue 11 12 3

Callbacks Programming interface for event-driven input Define a callback function for each type of event the graphics system recognizes This user-supplied function is executed when the event occurs GLUT example: glutmousefunc(mymouse) mouse callback function 13 GLUT callbacks GLUT recognizes a subset of the events recognized by any particular window system (Windows, X, Macintosh) -glutdisplayfunc -glutmousefunc -glutreshapefunc -glutkeyboardfunc -glutidlefunc -glutmotionfunc, glutpassivemotionfunc 14 GLUT Event Loop The display callback Recall that the last line in main.c for a program using GLUT must be glutmainloop(); which puts the program in an infinite event loop In each pass through the event loop, GLUT - looks at the events in the queue - for each event in the queue, GLUT executes the appropriate callback function if one is defined - if no callback is defined for the event, the event is ignored The display callback is executed whenever GLUT determines that the window should be refreshed, for example - When the window is first opened - When the window is reshaped - When a window is exposed - When the user program decides it wants to change the display In main.c -glutdisplayfunc(mydisplay) identifies the function to be executed - Every GLUT program must have a display callback 15 16 4

Posting redisplays Many events may invoke the display callback function - Can lead to multiple executions of the display callback on a single pass through the event loop We can avoid this problem by instead using glutpostredisplay(); which sets a flag. GLUT checks to see if the flag is set at the end of the event loop If set then the display callback function is executed Animating a Display When we redraw the display through the display callback, we usually start by clearing the window -glclear() then draw the altered display Problem: the drawing of information in the frame buffer is decoupled from the display of its contents - Graphics systems use dual ported memory Hence we can see partially drawn display - See the program single_double.c for an example with a rotating cube 17 18 Double Buffering Using the idle callback Instead of one color buffer, we use two - Front Buffer: one that is displayed but not written to - Back Buffer: one that is written to but not displayed Program then requests a double buffer in main.c -glutinitdisplaymode(gl_rgb GL_DOUBLE) - At the end of the display callback buffers are swapped void mydisplay() { glclear(gl_color_buffer_bit.). /* draw graphics here */. glutswapbuffers() 19 The idle callback is executed whenever there are no events in the event queue -glutidlefunc(myidle) - Useful for animations void myidle() { /* change something */ t += dt glutpostredisplay(); Void mydisplay() { glclear(); /* draw something that depends on t */ glutswapbuffers(); 20 5

Using globals The form of all GLUT callbacks is fixed - void mydisplay() - void mymouse(glint button, GLint state, GLint x, GLint y) Must use globals to pass information to callbacks float t; /*global */ void mydisplay() { /* draw something that depends on t 21 6