Answered step by step
Verified Expert Solution
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,
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 MoodleStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started