



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 FIVE questions. All questions carry equal marks.
Examiners: Ms. H. Fagan Dr. M. O’Cinneide Mr. M. Donnelly
Question 1
i. Write the code to set up a display list that draws a unit square centred on (0,0). (4 marks) ii. Write the display function that uses this display list to draw a unit square rotated by 45 degrees and centred at (2, 2) and (-2, –2). (5 marks)
iii. What code is required to set the projection plane in 2D so that both squares are visible? (3 marks) iv. Describe the three transformations that make up the window to viewport transformation and show how they are combined into a single matrix. (8 marks)
Question 2 i. Show with the aid of a diagram the information that must be specified to include a camera with perspective projection in a 3D graphics program. (6 marks)
ii. The camera frame uses three basis vectors known as u, v and n. How are these vectors derived from the information specified for the camera? (8 marks)
iii. What is double buffering and why is it used? How would you set up an animation in an OpenGL program that moves a camera? (6 marks)
Question 3
i. Describe the operations that may be applied to the accumulation buffer using glAccum. (6 marks)
ii. Write a sample piece of code to illustrate how to use the accumulation buffer in OpenGL to obtain the effect of motion blur in a scene. (8 marks) iii. Describe with the aid of an example how the alpha value is used to achieve blending using glBlendFunc. (6 marks)
Question 6
i. Distinguish between the image space and object space approach to hidden surface removal. (6 marks)
ii. Describe the Cohen Sutherland clipping algorithm in 2D. (10 marks)
iii. How are bounding boxes useful for clipping? (4 marks)
GLAPI void APIENTRY glBlendFunc( GLenum sfactor, GLenum dfactor ); GLAPI void APIENTRY glClear( GLbitfield mask ); GLAPI void APIENTRY glClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ); GLuint glGenLists( GLsizei range ); void glAccum( GLenum op, GLfloat value ); void glBegin( GLenum mode ); void glCallList( GLuint list ); void glClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ); void glColor3f( GLfloat red, GLfloat green, GLfloat blue ); void glEnd( void ); void glEndList( void ); void glLighti( GLenum light, GLenum pname, GLint param ); void glLoadIdentity( void ); void glMaterialf( GLenum face, GLenum pname, GLfloat param ); void glMatrixMode( GLenum mode ); void glNewList( GLuint list, GLenum mode ); void glOrtho( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, void GLdouble near_val, GLdouble far_val ); void glRotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ); void glScalef( GLfloat x, GLfloat y, GLfloat z ); void glTexCoord2f( GLfloat s, GLfloat t ); void glTexImage2D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); void glTexParameteri( GLenum target, GLenum pname, GLint param ); void glTranslatef( GLfloat x, GLfloat y, GLfloat z ); void glVertex2f( GLfloat x, GLfloat y ); void glViewport( GLint x, GLint y, GLsizei width, GLsizei height ); void glBindTexture( GLenum target, GLuint texture ); void glDeleteTextures( GLsizei n, const GLuint *textures); void glGenTextures( GLsizei n, GLuint *textures ); void glLightfv( GLenum light, GLenum pname, const GLfloat *params ); void glMaterialfv( GLenum face, GLenum pname, const GLfloat *params ); void gluLookAt (GLdouble eyeX, GLdouble eyeY, GLdouble eyeZ, GLdouble centerX, GLdouble centerY, GLdouble centerZ, GLdouble upX, GLdouble upY, GLdouble upZ); void gluOrtho2D (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top);