جـامـعـة اإلسـكنـدرية كـليـة الهنـدسـة البرامج العلمية المتخصصة برنامج الحاسبات و اإلتصاالت ALEXANDRIA UNIVERSITY FACULTY OF ENGINEERING Specialized Scientific Programs Computer & Communication Program Course Title: Computer Graphics Course Code: CC485 Student ID: Date: 14/11/2019 Time allowed: one hour Student Name: Score: /40 Answer all the following three questions (total marks is 40) Q1) Select the best answer (16 marks) 1) Which of the following function is allowed between glBegin/ glEnd ? a) glRotate () b) glLoadIdentity c) glPointSize d) glortho2d 2) What is the inverse of applying a scaling S(2,3) followed by a Rotation R(45) to a point p? a) S(2,3).R(45) b) S( 1/2,1/3).R(-45) c) S( 1/2,1/3).R(45) d) R(-45).S( 1/2,1/3) 3) The point (2,1) will be mapped by a mirroring around the axis x= 0 followed by a mirroring around the axis y = 0 followed by a uniform scaling by 2 (sx=2 and sy=2) to ------------a) (4,2) b) (-4,-2) c) (-2,-1) d) (4,-2) 4) The corresponding OpenGL code for the inverse of mirroring around the axis x= 1 followed by a mirroring around the axis y = 2 is ------------a) glTranslate(1, 2,0);glRotate(-180,0,0,1); glTranslate(-1,-2,0); b) glTranslate(-1, -2,0);glRotate(180,0,0,1); glTranslate(1, 2,0); c) glRotate(-180,0,0,1); d) glTranslate(1, 2,0);glRotate(-180,1,0,0); glTranslate(-1,-2,0); 5) A point (x,y) will be mapped by mirroring around the axis y=0 to ----a) (x, y) b) (x,-y) c) (-x, y) d) (-x,-y) 6) The combined transformation matrix C for mirroring around the axis x= 2 followed by a mirroring around the axis y = 1 followed by a uniform scaling by 2 (sx=2 and sy=2) is a) C=S(2,2)×T(-2,-1)×R(180) ×T(2,1) b) C=S(2,2)×T(2,1)×R(180) ×T(-2,-1) b) C=S(2,2)×T(2,1)×R(90) ×T(-2,-1) d) C=T(2,1)×R(180) ×T(-2,-1) ×S(2,2) t 7) If the number of colors is 2 and the resolution is 8 ppi then the bit depth is a) t b) 2t c)2t d)8t 8) when a color lookup table of size 256 is used the new size of a true color image is almost a) old size/8 b)old size/256 c) old size/3 d)old size 9) As the bitmap image is made larger:a) edges become more jagged b) Quality decreases c) File size increase d) All of the above 10) Process of creating broad contours and structure of 3D objects and scenes (top, side, cross section) is a) rendering b) modelling c)animation d) movie 11) As the vector image is made larger:a) edges become more jagged c) Quality decreases b) File size increase d) none of the above Page 1 of 4 12) Creating an environment where a user becomes part of the experience is called a) animation b) virtual reality c)simulation d) modelling 13) where is your openGL program resides? a) in the buffer and executed by the GPU b) in the RAM and executed by the CPU c) in the buffer and executed by the video controller d) in the RAM but executed by the GPU 14) The graphic pipeline is executed by the a) display processor b) main processor c) video controller d) web server 15) if you need a very large display device for a simulator the best technology is a) LCD b)LED c) CRT d)Plazma 16) if the reolution of a bitmap image changed from d to 2d the download time will change from t to ---a) t/4 b)t/2 c) 4t d)2t Q2) Transformation [--------/12 marks] a) Write down three openGL commands to do a rotation around the point (-1,2) by 90̊ clockwise. gltranslate(-1,2,0); glrotate(-90,0,0,1); gltranslate(1,-2,0); b) Compute a 2×2 transformation matrix for a rotation with angle 90̊ around the point (0, 0) in 2D space followed by scaling by 2 in y direction. Apply the resulting matrix to the point (0,1). [1,0;0,2] [0,-1;1,0] [0,1]` =[0,-1;2,0][0,1]`=[-1,0]` c) Prove that that rotation around the point (0,0) by 180̊ is the inverse of mirroring around x=0 followed by mirroring around y=0 Mirroring matrix (M)=[-1,0;0,-1] Matrix for Rotation by 180 (R)= [-1,0;0,-1] MR=RM=I Page 2 of 4 Q3) OpenGL [--------/12 marks] Answer the following questions after reading the following code. void display(void) {glMatrixMode(modelview); glLoadIdentity(); glRotatef(180, 0, 0, 1); gl_begin(GL_Triangle) glvertix2i(0,2); glvertix2i(2,2);glvertix2i(0,0); gl_end glLoadIdentity();} void mouse(int button, int state, int x, int y) { switch (button) { case GLUT_LEFT_BUTTON: if (state == GLUT_DOWN) exit(0); break;}} void keyboard(unsigned char key, int x, int y){} int main(int argc, char** argv){ glutInit(&argc, argv); glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB); glutInitWindowSize (argv[3], argv[2]); glutInitWindowPosition (100, 100); glutCreateWindow (argv[1]); glutDisplayFunc(display); glutMouseFunc(mouse); glutKeyboardFunc(keyboard); glutMainLoop(); return EXIT_SUCCESS;} a) Describe the scene that will be displayed by the program? When the program terminate? Exit when left mouse button clicked b) Rewrite the display function to display the letter V in 3D Gl_begin(glQuadStrip) Glvertex3i(1,1,0); Glvertex3i(1,1,-1); Glvertex3i(0,0,-1); Glvertex3i(0,0,0); Glvertex3i(-1,1,0); Glvertex3i(-1,1,-1); glEnd Page 3 of 4 c) Write down the necessary modification to the above program to rotate the letter V around the intersection line of the letter V incrementally and associate the rotation with the right mouse button c1) Modification To the display function (only the rotation commands): glrotate(theta,0,0,-1); c2) Modification to the Mouse function (use the right button): case glut_right_down <global variable> rotation~ = rotation; break; c3) Modification to the main function (register the idle function) : glutidlfunc(myidle); c4) The idl function: void myidl() { If (rotating) { ++theta; If (theta>360) then theta=0; glutpostredisplay(); } } Good Luck …. Dr. Mohamed Abdelhafeez Page 4 of 4