$25
1. Implement a basic OpenGL viewer and show an animation of a hierarchical model using the viewer. This viewer will also be used in future class assignments.
A. You have to implement all requirements in a single program. This assignment DOES NOT require each requirement to be a separate program
B. The window size doesn't need to be (480, 480). Use the larger window that is enough to
see the details of the viewer.
2. Requirements
A. Manipulate the camera with mouse movement
i. Refer the camera manipulation of Blender software.
1. https://www.blender.org/download/
ii. The camera of your program should initially look at a target point, similar to that of Blender.
1. Initialize the target point to the origin (0, 0, 0)
2.
iii. Provide the following three camera control operations.
1. Orbit: Rotate the camera around the target point by changing azimuth / elevation angles. (MMB (mouse middle button) in Blender)
A. Do not rotate the camera about a vector from the camera to the target point.
2. Panning: Move both the target point and camera in left, right, up and down direction of the camera (Shift-MMB in Blender)
A. More specifically, translate both the target point and camera along u axis (left & right) and v axis (up & down) of the camera frame
3. Zooming: Move the camera forward toward the target point (zoom in) and backward away from the target point (zoom out) (Ctrl-MMB in Blender) A. A. More specifically, translate the camera along w axis of the camera frame
B.
4. You MUST use the following mouse movement:
A. Orbit: Click mouse left button & drag
B. Panning: Click mouse right button & drag
C. Zooming: Rotate mouse wheel
D. Using above mouse movements is essential for scoring your assignment, so if you use any other set of mouse movement or keyboard shortcuts
for Orbit / Panning / Zooming, you won’t get any score for them.
iv. Use perspective projection
v. Draw a rectangular grid with lines (not polygons) on xz plane as a reference ground plane (similar to Blender). Choose number of rows and columns, size as you want.
B. Create an animating hierarchical model using OpenGL matrix stacks
i. The model should consist of 3D primitives such as boxes and spheres,
ii. You can use drawCube() and drawSphere() in the last page, or your own drawing
functions (which should use only numpy, opengl, glfw).
iii. DO NOT use glut or glu functions to draw 3D primitives (e.g., glutSoildBox(), gluSphere(),…) because they generate runtime crashes on some systems (maybe
problems of some python bindings, but don’t use them anyway). iv. Because we’ve not covered shading yet, just draw your model in wireframe mode by calling the following function at the beginning of your render function:
1. glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ) # call this at the beginning of
your render function
2. You can change the color of your wireframe primitives using glColor*().
v. You should use OpenGL matrix stack to draw and animate your hierarchical model.
vi. The model should have a hierarchy of at least 3 levels (20 pts).
1. For example, the following model has a hierarchy of 4 levels.
2.
vii. Animate the model to show the hierarchical structure .
1. Make all child body parts move relative to their parent body part.
A. In the above example, part 2, 3, 4, 5, 6 should move relative to part 1, part 7 should move relative to part 2, part 11 should move relative to part 7, … and
so on.
B. If any of the child bodies does not move relative to its parent, you will
get -.
2. You can make any hierarchical system freely. Be creative.
A. Eg) a hand with fingers bending
B. Eg) a runner with arms and legs swing
3. The model should be automatically animated without any mouse or keyboard
inputs.