Using OpenGL (Version 2.0) Solution



Introduction In this assignment we will use the OpenGL graphics API to create and display a three-dimensional image of a 20-sided Icosahedron. The Icosahedron is the largest possible Platonic Solid figure. All faces of the Icosahedron are equliateral triangles, with 5 triangles meeting at each vertex. The Icosahedron has a total of 12 vertices. The project skeleton code provides you with the three-dimensional vertex points, and a list of the vertices for each of the equlateral triangles. In this set of vertices, each vertex is exactly one unit from the 0,0,0 point, which is the center of the Icosahedron. The skeleton code also provides for a main program that calls one of several test cases, as follows.

1. Test 1 – Draw the Icosahedron. Simply draw the Icosahedron in 3–D space and display it from any viewing point of your choosing. The result should look similar to the figure below. Be sure to draw both the triangles polygons (the blue faces in this figure) and the polylines (the white lines in this figure). GRAD STUDENTS make each face a different color (use any algorithm of your choosing).

Image missing

2. Test 2 – Idential to test 1, but add a 10 hertz (update every 100ms) and animation rotation about both the x and y axes. You should rotate approximately 1 degree on each update.

3. Test 3 – Start with the Icosahedron and find the center point of each edge of each of the 20 triangles. Next create a vector from the 0,0,0 point to the midpoint of each edge. These midpoints will NOT be one unit from the enter. Extend these vectors to be exactly one unit from the origin, and then subdivide the original triangle into four smaller triangles, with the vertices all being one unit from the origin. GRAD STUDENTS make each face a different color (use any algorithm of your choosing). The result should look similar to the figure below.

Image missing

4. Test 4 – Identical to test 3 but adding rotation as in test 2.

5. Test 5 – A command line argument will specify the depth of the subdividing the rectangles. Test 3 is a depth of one (subdivide the triangles just once). For a depth of two, take each of the smaller triangles after the depth

1 subdivision and divide each of those into four smaller triangles. Continue the subdividing until the desired depth is reached. Do not try a depth more than 5 or so, as it will take forever and use excessive memory. The figure below shows a depth of 4.

6. Test 6 – Identical to test 5 but adding rotation as in test 2.

Image missing

Copying the Project Skeletons

1. Log into using ssh and your prism log-in name.

2. Copy the files from the ECE6122 user account using the following command:

/usr/bin/rsync -avu /nethome/ECE6122/Icosahedron .

Be sure to notice the period at the end of the above command.

3. Change your working directory to Icosahedron cd Icosahedron

4. Copy the provided to as follows:


5. Then edit to create your code for the test cases.

Turning inyourProject. Turnin yourprojectby usingthe turnin-ece6122or turnin-ece4122scriptdepenedingon yoursection.