Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

write an OpenGL program to draw a windmill and some hills. They are positioned o

ID: 3635503 • Letter: W

Question

write an OpenGL program to draw a windmill and some hills. They are positioned on a horizontal ground plane. You can use functions such as glutWireCube() and glutWireCone() to construct your scene objects.

1. First draw the ground plane. The ground plane is the XZ plane, and has its origin at (0, 0, 0). The positive Y axis is the vertical axis for this world. The ground plane has dimensions 20 units in X (going from -10 to 10) and 20 units in Z (going from -10 to 10). Draw a set of grid lines at a spacing of 1 unit along the X axis and the Z axis.

2. Draw the X, Y, Z axes at the origin using three lines colored red, green, and blue respectively. The length of each line should be 1 unit.

3. Select the initial camera location to be at (0, 1, 5) and pointing parallel to the negative Z-axis. Let the default projection mode be perspective projection.

4. Draw the windmill with the center of its base at (0, 0, -3). The windmill should have two blades perpendicular to each other forming a cross. The tower and the blades can be modeled as rectangloids using the glutWireCube() function.

5. Create hills using the glutWireCone() function. You should have at least five hills in your scene. Some of the hills should be along the back of the scene (that is, the z = 10 edge of the scene), and additional hills may be placed along the perimeter of the scene. Use the glColor3f() function to display the ground plane, windmill, and hills in different
colors.

6. To enable user control of the viewpoint, write functions to translate the viewer forward, backward, to the left, to the right, and to rotate in place. These viewer interactions will be performed using both the mouse and keyboard as specified below. The main keyboard events and the corresponding desired behavior are:

• w/s keys: The viewpoint moves 0.1 unit forward/backward respectively, with no change in orientation.
• a/d keys: The viewpoint moves 0.1 unit to the left or 0.1 unit to the right respectively, with no change in orientation.
• Provide the ability to rotate the viewer left by five degrees about the Y axis with each click of the ‘comma’ key (which also has the < symbol) and rotate the viewer right by five degrees about the Y axis with each click of the ‘period’ key (which also has the > symbol). This can be helpful during debugging. Note that these rotations are in place.
• r key: Add the ability to rotate the windmill. The windmill should rotate by 10 degrees about its horizontal axis at each key press.
• i key: The camera and objects are returned to the initial configuration.
• q key: The program quits.

The main mouse event is:

• With the left mouse button pressed, a leftward horizontal motion of the mouse should rotate the viewer left, and a rightward horizontal motion of the mouse should rotate the viewer right

Explanation / Answer

Hi i have written the code on my linux machine, but i can't type it and post it here because time has expired please rate me lifesaver and i'll make sure the answer is in your inbox! or my effort and time would go all in vain i don't do this generally but i am doing because of the circumstances