CS2150 Aston University School of Engineering & Applied Science CS2150: Computer Graphics January Examinations 2010 Date: XXX Time: XXX Instructions to Candidates: 1. Answer Question ONE and any other TWO questions. 2. Question ONE is worth 40 marks, all other questions are worth 30 marks. Materials provided: 1. An Appendix summarising OpenGL commands appears on the final page. Page 1 of 5
COMPULSORY QUESTION 1. a) Define what is meant by the term computer graphics. (3 marks) b) Using a sketch and description, show why it was only possible to view early liquid crystal displays from almost directly in front of the screen? Give TWO recent technologies that have improved viewing angles. c) What is meant by scan conversion? Explain why modern graphics pipelines typically use some variant of the z-buffer algorithm for scan conversion. d) When referring to a 3D object we talk about its geometric, topological and attribute properties. In computer graphics terms, to what do these relate? (3 marks) e) When considering the 2D display of 3D computer graphics what is meant by the projection plane? Using a sketch and description, show how a projection plane can be specified. f) Explain the roles of the GL_PROJECTION and GL_MODELVIEW matrices in the OpenGL rendering pipeline. g) List FOUR possible interactions of light with a material surface and explain how OpenGL represents these. (8 marks) h) What are the differences between object precision and image precision approaches to visible surface determination? Give ONE example where image precision methods might be faster. Page 2 of 5
2. This question refers to OpenGL. An appendix showing the OpenGL API calls can be found at the end of this paper. a) Describe the role of OpenGL in computer graphics. (3 marks) b) Write a renderscene() method to draw a flat red square of size 2 by 2 in world coordinates in the x,z plane, with the square centre positioned at location (0,2,-10). Provide a sketch of the object in world coordinates. Use of clear style will be given extra marks and you may assume that all supporting functionality used in the graphics labs is available. (17 marks) c) Show the changes to the renderscene() method such that the red square from (b) could be made to bounce up and down by 5 units along the y-axis when the program starts. Write the associated updatescene() method that would also be required, and document any other changes needed to the Java class. (10 marks) 3. a) Show how a simple 2D translation of (-1,5) can be represented as a transformation matrix. Apply this transformation matrix to the vertex (4,3), and give the resulting vertex in homogeneous coordinates. b) The vertex resulting from (a) must also be scaled by a non-uniform scaling of 2 in the x direction, and 0.5 in the y direction. Show the composite transformation matrix for these two transformations, and use this to compute the coordinates of the translated and scaled vertex. (7 marks) c) In what circumstances might it be useful to compute an inverse transformation matrix? Give the inverse of the composite transformation matrix computed in (b). d) Explain the role of the matrix stack in OpenGL and explain how it could be used to construct hierarchical models of objects we wish to display. What is the relation of the matrix stack to a scene graph? (8 marks) e) Describe TWO methods that can be used to define animations in computer graphics using OpenGL, and for each give ONE advantage of that approach. Page 3 of 5
4. a) Using a sketch and description, show the typical design of a video controller which generates the appropriate horizontal and vertical position signals for a display device. b) Using a sketch and description, show a single address space graphics system architecture (sometimes called an integrated architecture). What benefits does the single address space graphics system have over the commonly used alternatives? (10 marks) c) Describe THREE methods that could be used in the graphics system to speed up the processing of the geometric computations that are common in 3D computer graphics. (9 marks) d) Describe what full screen anti-aliasing is and suggest how this could be implemented on a graphics system. 5. a) Describe the colour model normally used in computer graphics. (3 marks) b) List the TWO main methods OpenGL uses to define the colour of objects in a scene. List ONE benefit for each approach. c) Explain the role that textures play in the rendering pipeline. At what stage in the rendering pipeline are they applied? d) Show, using a sketch and description, how texture mapping works, and show how this is implemented in OpenGL. (12 marks) e) Give TWO examples of recently introduced techniques in modern rendering pipelines and explain how each increases visual realism. Page 4 of 5
Appendix A: OpenGL commands. void glbegin ( GLenum mode ) void glbindtexture( GL_TEXTURE_2D, * ) void glcolor3# ( * R, * G, * B ) void glend ( void ) void glflush ( void ) void glfrustum ( float left, float right, float bottom, float top, float znear, float zfar ) void gllightfv ( GLenum light, GLenum pname, float params[] ) void gllinewidth ( float width ) void glloadidentity ( void ) void glmaterialfv ( GLenum face, GLenum mname, float params[] ) void glmatrixmode ( GLenum mmode ) void glnormal3# (* x, * y, * z ) void glpointsize ( float size ) void glpolygonmode ( GLenum face, GLenum polymode ) void glpopmatrix ( void ) void glpushmatrix ( void ) void glrotate# (* angle, * x, * y, * z ) void glscale# (* x, * y, * z ) void glshademodel ( GLenum shademode ) void gltexcoord2f( * x, * y ) void gltranslate# (* x, * y, * z ) void glvertex # ( * ) void glulookat ( float eyex, float eyey, float eyez, float centerx, float centery, float centerz, float upx, float upy, float upz ) # indicates one of f, i, fv, iv. indicates an integer in the range 2, 3, 4. * indicates a type float, int. Enumerated types: face: GL_FRONT, GL_BACK, GL_FRONT_AND_BACK. light: GL_LIGHTi. mname: GL_AMBIENT, GL_DIFFUSE, GL_SPECULAR, GL_SHININESS. mode: GL_POINTS, GL_LINES, GL_TRIANGLES, GL_QUADS, GL_POLYGON. mmode: GL_MODELVIEW, GL_PROJECTION. pname: GL_AMBIENT, GL_DIFFUSE, GL_SPECULAR, GL_POSITION. polymode: GL_POINT, GL_LINE, GL_FILL. shademode: GL_FLAT, GL_SMOOTH. END OF EXAMINATION PAPER Page 5 of 5