Introduction to Computer GraphicsFarhana Bandukwala, PhDLecture 3: Graphics SystemOutline• Raster system architecture• Input and Output Devices & Interaction (Angel, Section 3.2)• Client/Server operating model(Angel, Section 3.3)• Graphics pipelineRaster Graphics System• Peripheral display processor for performance• Display memory: data plus rasterizer software• Frame buffer: image to display• Video controller: low level monitor specific driverCPUDisplay processor System memoryPeripheralDevicesDisplayProcessormemoryFramebufferVideocontrollerMonitorSystem busInput devices: locators• Absolute devices: digitizing drawings– Data tablet– Touch panel• Relative devices: navigate arbitrarily large space– Mouse– Trackball– Joysticks• Direct (light pen) vs indirect (mouse)• Continuous (mouse) vs discrete (cursor control keys)Input devices: others• Keyboard • Choice devices: function keys• Voice recognizers• 3D devices– Joysticks– Spaceball– Data GloveCommon output devices• CRT– Electrons directed towards phosphor-coated screen which emits light at discrete points• LCD– Polarizing crystalline molecules• Active matrix panels– LCD with a transistor at each point• Plasma panels– Array of tiny neon bulbs -> no refresh!Interaction tasks• Positioning– Coordinate systems, resolution• Selection – Choice sets: objects, properties,commands• Text input– Application does not interpret input• Quantification– Numeric rangeInteraction handling models• Request mode: – Application requests input from device– Graphics package returns control after user “triggers”– One device triggered at a time• Sample mode– Application polls all devices– Input at other devices can be missed while processing particularone• Event mode– Input is accepted asynchronously from different devices at once– Event queue may contain contradicting eventsEvent Processing• Asynchronous events received from different devices• Application needs to constantly query event queue (glutMainloop())• Each event processed by appropriate function (callback) (glutDisplayFunc(), glutMouseFunc(), glutKeyboardFunc(),etc.)• Callback responsible for state-based processingMouse KeyboardEvents generatedEvent queueEvent processingWindow managerGLUT libraryApplicationCB1CB2 CB3Event processing (example)1. Create menu & Register callback glutCreateMenu(void (*func)(int entryType))2. Add Menu Entries glutAddMenuEntry(char *name, int entryType)3. Implement callback function • Performs different actions depending on value of entryType#define MENU_DISPLAY 1#define MENU_EXIT 2// Menu callback functionvoid menuCB(int menuEntry){switch (menuEntry){case MENU_DISPLAY:...break;case MENU_EXIT:...exit(0);break;}}int main(int argc, char ** argv){...// Create menu and register callbackint menuID = glutCreateMenu(menuCB);// Add Menu EntriesglutAddMenuEntry(“Display”,MENU_DISPLAY);glutAddMenuEntry(“Exit”,MENU_EXIT);// Process eventsglutMainLoop();}Client server model• Window management system– Window manager:• interacts with applications requesting operations on windows• Allocates screen space for applications (windows)• Routes events to appropriate applications– Window system: • Low level functions which manipulate windows (Xwindows)• Window management system is a server• Applications which use system are clientsCommunications for Client/Server• Interprocess communication protocol• Need to minimize communication delays– Asynchronous messages (events)– Design single message to replace multiple messages– Move more functionality into serverApplication 1Application 2High levelgraphics pkg(Open GL)Window System (&Basic Graphics)OperatingSystem (&VideoController)SystemHardware (& Graphics accelerator)ClientsServerEvents for Multiple Clients123Client 1Client 2Window managerOutput primitives,window manipulation commandsEvent reportsEvent reportsOutput primitivesDisplay processor Pipeline• Transformer: modify object such that viewed from correct angle• Clipper: clips primitives to screen window• Projector: project 3-D scene to 2-D image • Rasterizer: scan convert, anti-aliasing operationsTransformer Clipper Projector
View Full Document