Thursday, April 5, 2012

Second Internal Question Bank(Computer Graphics and Visualization)

1) How do you implement menus in OpneGL. Write code for a multilevel menu with options of quit and resize. Resize is a submenu with options of increase square size and decrease square size.

2) Write fragments of OpenGL code to draw and rotate it when left button is pressed and stop rotation when middle button is pressed (without calling glRotatef).

3) When do you make use of double buffering? How to use double buffering? How do you force a draw into both the front and back buffer.

4) Explain the use of a timer. How do you make use of a timer function to call the display at a constant rate irrespective of machine clock frequency.

5) Write an OpenGL C program to draw small squares wherever the Left Mouse Button is clicked. The program should terminate when Right Mouse Button is pressed. The 'Init' function should initialize the viewport and view volume to default values and 'Reshape' function should reset them for new values of window size.

6) a) How do you register a function for mouse motion callback?

b) How do you register a function for keyboard callback?

c) How do you register a function for Idle callback?

d) How do you create multiple windows and draw in them?

 7) Create a menu( with options quit,increase font size and decrease font size)and attach it to the right mouse button. Write the associated callback function. How do you create a submenu called resize (with options increase square size and decrease square size) and attach it to the right mouse button.

8)a)Describe operations in affine space such as vector-vector addition, point-point subtraction and point-vector addition.
b) What does an affine sum such as Q=P+ α*v mean. If  P={1,2,3},α=0.2,v={1,1,0}Calculate Q. Generalize this to addition of two points. Also Define what is a convex hull.

9) How do you form specification of a plane passing through three points P, Q, R using parameters α, β. How can you define equation of a plane using it surface normal n.

10) Derive the transformation matrix to transform a point from world coordinate system (v1,v2,v3) into camera coordinate system(u1,u2,u3). If for example u1=v1,
               u2=v1+v2
               u3=v1+v2+v3 How is a vector {1, 2, 3} transformed from (v1, v2, v3) into (u1, u2, u3).

11) How do you specify order of vertices for drawing an inward facing and outward facing polygon.

12) Give the data structure to store a cube as an array of pointers to vertex-list.

13) How do you color the faces of a cube using bi-linear interpolation. What if the four vertices of the face do not lie in the same plane.

14) How can a cube be drawn using less number of function calls. Give the complete program to spin the cube while the program is idle whereas the cube is drawn using vertex arrays.

15) Derive the transformation matrices for translation, rotation and scaling in 3D using homogeneous coordinates.

16) Derive the composite transformation matrix for rotation w.r.t. z axis about a fixed point in 3D.

17) Derive the composite transformation matrix to transform a window defined by points (xmin, ymin) and (xmax, ymax) to a viewport defined by points (xvmin,yvmin)and (xvmax, yvmax).(Hint: Perform translation,scaling and translation in that order)

18) Derive the composite transformation matrix for rotating a cube centered at point p0 by angle θ w.r.t an axis defined by the line joining points p1, p2. (repeated twice)

19) How do you rotate an object w.r.t a fixed point (4,5,6) about a line through the origin and the point (1,2,3) using OpenGL functions.

20) a)If three transformations of translation, rotation and translation are specified in order what is the order of their execution.
b) Which functions can modify the modelview matrix.


21) How can you implement a virtual trackball using a 2D input device like the mouse.

22) How are smooth rotations (w.r.t x,y,z axis) and incremental rotations implemented.

23) What are quaternions? Find the quaternion’s for 90-degree rotations about x- and y-axes. Determine their product.