RECENT ASSIGNMENT

Tweet Share WhatsApp Share
GET ANSWERS / LIVE CHAT


Laboratory 6 – 3D Object Representation
Learning objectives:
? Enhance the understanding of sweeping representation approach;
? Be able to construct a 3D object using sweeping representation
? Be able to use a display list ins OpenGL;
? Be able to control the display use a menu with a sub-menu.
Task:
Write a C++ program to construct and display an ellipsoid (Fig.1) (centered at the origin of world coordinate system with radii rx = 100, ry = 120 and rz = 150 units) using sweeping representation.
Figure 1 radii of an ellipsoid (reproduced from Figure 12-4 in the textbook)
Formulas referenced to the coordinate system shown in Fig.1, which are used to calculate the vertices of polygon (quads or triangles) meshes are listed below:

Figure 2 Reference coordinate system for the formula above (reproduced from Figure 12-5 in the textbook)
Parameters for the display window:
? Position (100,400),
? size 600 by 300 and
? Caption “Build an ellipsoid and display it using perspective projection”.
Parameters for the viewing system:
? Use the function “gluPerspective” to set up the viewing volume;
? Center of projection: (0.0, 0.0, 350);
? Look at point: (0.0, 0.0, 0.0);
? View up vector: (0.0, 1.0, 0.0);
? fvoy is 60;
? aspect ratio of the clipping window is 1.0;
? The near and far clipping planes: Znear = 100, Zfar= 600;
Split the display window into two equal viewports.
In the first viewport, display the ellipsoid in a color of your choice by calling the functions from GLU library, such as gluSphere() and proper transformation functions.
In the second viewport, display the ellipsoid using your own C++ functions. You need to create a display list which includes the construction of ellipsoid using a graphics primitive (GL_TRIANGLE_STRIP) as a sweeping representation. Call the display list in the main function.
Add keyboard controls to rotate the ellipsoid in each display window, “x” or “X” for rotating around the x axis, “y” or “Y” for rotating around the y axis, “z” or “Z” for rotating around the z axis, “i” or “I” for being back to the original position and “ESC” key (ASCII code is 27) to exit. The rotation step is 30o.
Add a menu to switch between “wireframe”, “Rendered” and “Exit” options. The right mouse button is assigned to the menu in the first display window while the left mouse button is for the second display window.
Add a sub-menu to control the color which can be red, green, blue, yellow, cyan and magenta.



GET ANSWERS / LIVE CHAT