Docsity

Computer Graphics Exam for Software Development and Computer Networking Students, Exams of Computer Graphics

Toggle sidebar
bg1
Cork Institute of Technology
Bachelor of Science (Honours) in Software Development and Computer
Networking – Award
(NFQ Level 8)
Summer 2006
Computer Graphics
(Time: 2 Hours)
Instructions
Answer FOUR questions.
All questions carry equal marks.
Examiners: Ms. H. Fagan
Dr. J. Buckley
Dr. A. Kinsella
Q1 (i) Write a display method for an openGL program that draws a two unit squares. The squares
should be centred at (1,1) (-1,1) respectively. You should use a single method to draw the
unit square. (8 marks)
(ii) What code is required to set the projection plane so that all the above squares are visible?
(4 marks)
(iii) What code would you add so that all the squares rotate 5 degrees each time the ‘r’ key is hit?
(6 marks)
(iv) Describe with the aid of an example why you would use glPushMatrix and glPopMatrix in an
openGL program?
(7 marks)
Q2. (i) Describe the three transformations that make up the window to viewport transformation and
show how they are combined into a single matrix.
(12 marks)
(ii) What code would you add to an openGL program to guarantee that the viewport is always
square?
(6 marks)
(iii) Explain what is meant by double buffering. Why is it used in animation? How would you
modify an openGL program to use double buffering?
(7 marks)
pf2

Partial preview of the text

Download Computer Graphics Exam for Software Development and Computer Networking Students and more Exams Computer Graphics in PDF only on Docsity!

Cork Institute of Technology

Bachelor of Science (Honours) in Software Development and Computer

Networking – Award

(NFQ Level 8)

Summer 2006

Computer Graphics

(Time: 2 Hours)

Instructions Answer FOUR questions. All questions carry equal marks.

Examiners: Ms. H. Fagan Dr. J. Buckley Dr. A. Kinsella

Q1 (i) Write a display method for an openGL program that draws a two unit squares. The squares should be centred at (1,1) (-1,1) respectively. You should use a single method to draw the unit square. (8 marks)

(ii) What code is required to set the projection plane so that all the above squares are visible? (4 marks)

(iii) What code would you add so that all the squares rotate 5 degrees each time the ‘r’ key is hit? (6 marks)

(iv) Describe with the aid of an example why you would use glPushMatrix and glPopMatrix in an openGL program? (7 marks)

Q2. (i) Describe the three transformations that make up the window to viewport transformation and show how they are combined into a single matrix. (12 marks)

(ii) What code would you add to an openGL program to guarantee that the viewport is always square? (6 marks)

(iii) Explain what is meant by double buffering. Why is it used in animation? How would you modify an openGL program to use double buffering? (7 marks)

Q3. (i) Describe with the aid of a diagram the viewing volume used in perspective projection. How

would you specify this in an openGL program? Use some sample code to illustrate your answer. (14 marks) (ii) What is meant by the camera frame? (6 marks)

(iii) Write the code you would use in an openGL program to specify a camera that is positioned at (0,10 ), looking down the y-axis and which has with a up vector parallel to the x-axis? (5 marks)

Q4 (i) Describe how outcodes are assigned to endpoints in the Cohen-Sutherland line clipping algorithm. Show the outcodes assigned for each sub-region. How are out-codes used to recognise lines that are completely outside the clipping rectangle?

(10 marks) (ii) What are the first four points you would draw for a line from (20,10) to (30,18) if you are using Bresenham’s algorithm? Show your calculations. (15 marks)

Q5 (i) Describe the equation used in the phong lighting model to calculate diffuse lighting. (6 marks) (ii) What vectors need to be known in order to calculate specular lighting using the phong lighting model? (3 marks )

(iii) Write out the code required to add a light that is a point source to an openGL program. What would you modify to change the point source into a distant source? (10 marks) (iv) Explain with the aid of a diagram the extra parameters that must be set for a spotlight. (6 marks)