Download presentation
Presentation is loading. Please wait.
Published byWendy McDaniel Modified over 8 years ago
1
Lecture 11: Exam Revision 1 Principles of Interactive Graphics CMSCD2012 Dr David England, Room 718, ex 2271 d.england@livjm.ac.uk Coursework deadline extended to Tuesday 4th Dec No demo session - email me your working code or submit it on disk No compliable code submitted means no marks for the demo
2
Lecture 11: Exam Revision 2 This Week Exam Revision Aims and objectives of the module Graphics Hardware Interactive graphics application framework Graphics context Transforms Texture mapping Lighting, Shading and Materials Sense of Depth
3
Lecture 11: Exam Revision 3 Learning outcomes Learning outcomes of the module. You should be able to: 1 Identify the hardware and software needed for Computer Graphics applications 2 Solve problems in 2D graphics and interaction 3 Develop applications using 2D graphics and 2D input devices 4 Explain the principles behind 2D and 3D graphics The exam tests 1, 2 and 4 (and OpenGL concepts) The coursework tested 2, 3 and 4
4
Lecture 11: Exam Revision 4 Graphics Hardware In lecture 4 we looked at Graphics hardware and the handout from PCW on PC graphics cards We looked at different display devices and how they fitted in with the display architecture of a machine We saw how graphics performance could be improved by various techniques We looked at the basic features of input devices for 2D and 3D graphics We looked at the features that make a device suitable for interaction
5
Lecture 11: Exam Revision 5 Handling Events 1 In Lecture 5 we looked at event handling in OpenGL Every interactive graphics program has the same model Initialise the application data and graphics environment Create the contents of the display Paint the contents of the display on a window Set-up functions to handle input events Start an infinite loop to handle input events This is event-driven programming I posed some questions about handling events for some items...
6
Lecture 11: Exam Revision 6 Handling Events 2 A scrollbar, e.g. e.g. top arrow box Click Left mouse button Show arrow box depressed Move client window up one unit Restore arrow box e.g. Central bubble Press left mouse button down Drag mouse Move client window in direction of mouse Release mouse The movement of the client may vary between applications
7
Lecture 11: Exam Revision 7 Handling Events 3 A pop-up menu Press right/left mouse button (left for MS Start Menu) Show top-level menu Loop 1: Drag mouse cursor over item Highlight item If item is sub-menu show sub-menu Continue loop 1: Press mouse button over item - do menu action Press mouse button not over item - hide all menus
8
Lecture 11: Exam Revision 8 Handling Events and Application Frameworks In Lecture 7 we also saw how input handling fits in with Object-Oriented application frameworks For example: Model-View controller in Smalltalk-80 Document/View structure in Java Swing and Microsoft Foundation Classes We also saw how graphical components could be designed as classes and objects The display and input handling of a class is built into the class itself A limited interface is exposed to the rest of the program
9
Lecture 11: Exam Revision 9 3D graphics: Transforms We started by looking at the basic transform operations Translation in the X, Y and Z planes Rotation about the X, Y and Z axes Scaling in X, Y and Z We discussed the concept of Graphics Context and saw that transformations are cumulative unless we change the context E.g. by loading the Identity Matrix - glLoadIdentity() Or (later on) by saving and then restoring the transformation context with glPushMatrix() and glPopMatrix() Rendering continues in the current graphics context unless the programmer changes it
10
Lecture 11: Exam Revision 10 Texture Mapping In Lecture 8 we looked at texture mapping We saw how texture objects could be created in a program or read from a file Textures can then be applied to an object to add detail to the scene without using extra polygons Texturing has to be enabled before texture objects can be used Texture coordinates go from 0.0, 1.0 in X and 0.0, 1.0 in Y We set different coordinates so we can match all, part or repeated copies of the texture across a set of vertices in a polygon We can also have the texture affected by materials and lighting
11
Lecture 11: Exam Revision 11 Lighting, Shading and Materials We saw in lecture 9 how lighting and shading can be controlled to give a sense of depth and position Shading can be flat or smooth across a polygon to give more realistic smooth objects We can enable lights in a scene and control their properties e.g. Colour or brightness Position of point source lights We can also control how an object responds to lighting by setting material values to make objects dull or shiny to match real-world surface reflections and colours Remember: Context and lighting
12
Lecture 11: Exam Revision 12 Sense of depth OpenGL gives a sense of depth via Lighting and shading (last section) Perspective gluPerspective() This set the angle of view the aspect ration of the scene The front and back viewable planes enabling Depth Testing Depth testing switches on hidden line and surface removal Without this all parts of an object would be visible
13
Lecture 11: Exam Revision 13 Answer to last tutorial question “Modify the rotate operation so that the scene rotates around the current viewpoint and not the origin” Create a camera object to store the current position in x,y and z and the current rotations about x,y, and z axes Take user input to move around the scene In the display function: translate and rotate using the current camera values Then redraw the whole scene See Chapter 19 Simple Tank in OpenGL Superbible - VC++ workspace is in L:\CD2012
14
Lecture 11: Exam Revision 14 Finally There are no trick questions Please read the exam questions carefully Plan out your answer Don’t do a brain dump of lecture notes/reading based on misreading questions Good Luck Any final questions ?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.