

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


(NFQ Level 8)
Instructions Answer FOUR questions. All questions carry equal marks.
Examiners: Ms. Helen Fagan Dr. J. Buckley Dr. A. Kinsella
Question 1
i. Write a display method for a 2D openGL program that draws a unit square centered at the origin. (6 marks) ii. What code needs to be added to make of the following changes:
iii. How would you implement zooming in and out, in a 2D openGL program? Illustrate your answer with some sample code. (10 marks)
Question 2
i. What is meant by the aspect ratio of a rectangle? What code would you add to an openGL program to guarantee that the viewport is always square? (8 marks)
ii. 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)
iii. Explain what the methods glPushMatrix and glPopMatrix do. Give an example of why you might use these methods. (10 marks)
Question 3 i. Describe with the aid of a diagram the viewing volume used in a. Perspective projection. b. Parallel projection (10 marks)
ii. How would you specify one of the above viewing volumes in an openGL program? (8 marks)
iii. What is the Canonical viewing volume? Describe how clipping can be applied to this viewing volume. (7 marks)
Question 4
i. Describe the z-buffer algorithm for hidden surface removal. (10 marks)
ii. What changes are required in an openGL program to enable hidden surface removal? (5 marks)
iii. Describe either the DDA or Bresenham line drawing algorithm. What is the main disadvantage of the DDA algorithm? (10 marks)
Question 5
i. Describe the equations used for calculating specular and diffuse lighting. Draw a diagram to illustrate the vectors that must be known for each equation.
(10 marks)
ii. What is lateral inhibition and what effect does it have on computer graphics? (5 marks)
iii. Describe how you would add a spotlight to an openGL program? Explain with the aid of a diagram the parameters that may be set for a spotlight. (10 marks)