Cd2012 principles of interactive graphics lecture 08
Sponsored Links
This presentation is the property of its rightful owner.
1 / 18

CD2012 Principles of Interactive Graphics Lecture 08 PowerPoint PPT Presentation

  • Uploaded on
  • Presentation posted in: General

CD2012 Principles of Interactive Graphics Lecture 08. Objects and Interactions Abir Hussain Previous Lecture. Creating texture within program Using texture Texture co-ordinates. Recall-Texture co-ordinates.

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

CD2012Principles of Interactive GraphicsLecture 08

Objects and Interactions

Abir Hussain

Previous Lecture

  • Creating texture within program

  • Using texture

  • Texture co-ordinates


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()


Recall-Texture co-ordinates


Today’s lecture and Lab



  • 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



  • 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?


OO Graphical user Interfaces

  • Smalltalk 80 was the first complete object-oriented programming environment.


  • Everything in Smalltalk-80 is an object, from integers upwards.


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.


How did you design your car park?

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.


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


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


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


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?


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!!


Today’s Lab

  • Demonstration of coursework 1

  • You are required to submit a copy of your program (even if it is not completed)



  • Object Oriented programming and design

    • Object oriented graphical user interface

    • Designing your own graphical object

  • Coursework 2

  • Demonstrating coursework 1


  • Login