Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Open GL programming for a cube. Please help (5) (10 marks) You are pushing a unit cube. Initially the cube is centered at (0, 0,

image text in transcribed

Open GL programming for a cube. Please help

(5) (10 marks) You are pushing a unit cube. Initially the cube is centered at (0, 0, 0) and you install a LookAt at (0, 0, 5) looking at it. Your cube keeps rotating around the y-axis, by 30 every time. You decide the time interval between two consecutive rotations. If you press the right mouse button and keep it pressed, your LookAt changes to (5, 5, 5) and stays there. If you release the button, the LookAt changes back to (0,0,5). Now let us add some interactions. Use the key a to push the cube forward along the z- axis and use the key "Z" to retreat the cube backward along the z-axix. Pushes or retreats should use the same distance. You decide its length. Every time you push or retreat the cube, you also need to adjust LookAt and possibly the projection such that the distance between your eye and the cube is constant, i.e., no change. During the above pushing process, if you press the right mouse button and keep pressed, your LookAt changes to (5, 5, z). If you release the button, the LookAt returns to (0, 0, z). For both situations, z depends on the current z location of the cube. Your cube is always rotating around the y-axis at its center. You decide and install an appropriate orthographic projection for the above tasks. Call your program push.c and create a make file, called pushMake, for compiling it. The executable is called push. Submit push.c and push Make on the Moodle. (5) (10 marks) You are pushing a unit cube. Initially the cube is centered at (0, 0, 0) and you install a LookAt at (0, 0, 5) looking at it. Your cube keeps rotating around the y-axis, by 30 every time. You decide the time interval between two consecutive rotations. If you press the right mouse button and keep it pressed, your LookAt changes to (5, 5, 5) and stays there. If you release the button, the LookAt changes back to (0,0,5). Now let us add some interactions. Use the key a to push the cube forward along the z- axis and use the key "Z" to retreat the cube backward along the z-axix. Pushes or retreats should use the same distance. You decide its length. Every time you push or retreat the cube, you also need to adjust LookAt and possibly the projection such that the distance between your eye and the cube is constant, i.e., no change. During the above pushing process, if you press the right mouse button and keep pressed, your LookAt changes to (5, 5, z). If you release the button, the LookAt returns to (0, 0, z). For both situations, z depends on the current z location of the cube. Your cube is always rotating around the y-axis at its center. You decide and install an appropriate orthographic projection for the above tasks. Call your program push.c and create a make file, called pushMake, for compiling it. The executable is called push. Submit push.c and push Make on the Moodle

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

8th Edition

013460153X, 978-0134601533

More Books

Students also viewed these Databases questions