1 / 18

CD2012 Principles of Interactive Graphics Lecture 08

CD2012 Principles of Interactive Graphics Lecture 08. Objects and Interactions Abir Hussain www.cms.livjm.ac.uk/cmsahus1. Previous Lecture. Creating texture within program Using texture Texture co-ordinates. Recall-Texture co-ordinates.

brygid
Download Presentation

CD2012 Principles of Interactive Graphics Lecture 08

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. CD2012Principles of Interactive GraphicsLecture 08 Objects and Interactions Abir Hussain www.cms.livjm.ac.uk/cmsahus1

  2. Previous Lecture • Creating texture within program • Using texture • Texture co-ordinates CD2012-08

  3. Recall-Texture co-ordinates • The coordinates of textures are named s along the X axis and t along the Y axis • The values of S and T range between 0.0 and 1.0 • We can use values between 0.0 and 1.0 to select part of the imaged to be mapped, or • We can use values greater than 1.0 to map multiple copies of the single texture across a polygon • Texture coordinates are set for each vertex of the target polygon with glTexCoord2f() CD2012-08

  4. Recall-Texture co-ordinates CD2012-08

  5. Today’s lecture and Lab CD2012-08

  6. Introduction • In CY2001 you will have come across concepts such as: • Defining Classes and Objects • Encapsulation (private variables and functions for classes) • Polymorphism - functions with the same name but different parameters • Moving from OO design to OO Programming CD2012-08

  7. Introduction • Abstraction (to different levels) is the main technique of problem solving in Computer Science. • OOD works by abstracting out the essential classes of objects in a problem. • identifying their attributes and their functionality • OOD and OOP help control the complexity of larger systems development. • In your own programs you will have seen the Display() function grow in size with the complexity of the graphical scene. • How could you have use OOD and OOP to control and manage this growth? CD2012-08

  8. OO Graphical user Interfaces • Smalltalk 80 was the first complete object-oriented programming environment. • http://www.cincom.com/scripts/smalltalk.dll//downloads/index.ssp • Everything in Smalltalk-80 is an object, from integers upwards. CD2012-08

  9. OO Graphical user Interfaces • The designers chose to split an application up into three part • The View - the graphical part • The Controller - the input handling part • The Model - the logical part of the application (text handling, database handling or whatever) • Objects in the Controller (e.g. a menu handler) send messages to the Model to do some calculation, which then sends a message to update the View. CD2012-08

  10. How did you design your car park?

  11. Designing your Own graphical Object • OpenGL is designed around the idea of sending commands down a graphical pipeline. • This maybe a good way of developing graphically intense programs such as games. • While this reflects the underlying hardware it is not always the best way to program all graphical applications. CD2012-08

  12. Designing your Own graphical Object • In your coursework you may have split up the display() function to call other functions to draw the parts of the scene • For example, a car() function which could draw a car in various locations CD2012-08

  13. Designing your Own graphical Object • The car() function could be extended to further parameters such as: • Colour of the car • Size of the car • Model of the car • The doors and the windows CD2012-08

  14. Designing your Own graphical Object • We could take advantage of OOD and design a car Class comprising: • Private attribute of the attributes listed above • An attribute for the current_location value • Constructors to create a new Car object • A draw function (hiding the OpenGL implementation) • An update function to change current_position and redraw the car CD2012-08

  15. Designing your Own graphical Object • The rest of the program would then only communicate with the car via • car.setCurrentPosition(int x, int y); • Think for a moment of what other objects in your scene you could create classes for • What would be their attributes? • What methods would be needed? • What attributes would be exposed to the rest of the program to update your object? CD2012-08

  16. Coursework 2 • In the second coursework, you are required to built a 3D office. • Use a pop up menu, keyboard interactions and buttons to allow the office: • To rotate about the three axes. • To scale the office in x and y-axes. • To change the colour of the various parts of the office from a choice of three colours. Extra mark can be gained by performing the three types of interactions!! CD2012-08

  17. Today’s Lab • Demonstration of coursework 1 • You are required to submit a copy of your program (even if it is not completed) CD2012-08

  18. Summary • Object Oriented programming and design • Object oriented graphical user interface • Designing your own graphical object • Coursework 2 • Demonstrating coursework 1 CD2012-08

More Related