Sale!

Computer Animation & Gaming Assignment 1

$30.00

Category:
5/5 - (2 votes)

CS 6323 Computer Animation & Gaming
Assignment 1 (10 points)
Write an OpenGL program that display a rotating cube.
1) Initially place a red cube (+/- 1, +/- 1, +/- 1) 5 units along the x-axis at (5, 0, 0) of world coordinate
system. This is already implemented in the provided starting code.
2) Draw a groundplane and y-axis of world coordinate system. Represent the y-axis by a cube (+/-0.5,
+/- 10.0, +/- 0.5), groundplane is parallel to xoz plane. This is already implemented in the provided
starting code.
3) Set different rendering material for cube, y-axis and groundplane. This is already implemented in
the provided starting code.
4) Rotate the cube around the global y-axis of world coordinate system (WCS) and at the same time
rotate around its own z-axis of local coordinate system (LCS).
For the rotating cube, do the following transformation in order:
a. rotate the cube around its own z-axis of local coordinate system by ‘a’ degrees; (grade: 4
points)
b. then rotate the cube by ‘b’ degrees around the global y-axis of world coordinate system.
(grade: 3 points)
Note that the rotation around its own z-axis will not change the position. The position of the
cube is changed when it rotates around the global y-axis. Some implementation hints are given
below.
5) The program should have user-interaction controls to allow users to interactively increase and
decrease a and b. The controls can be buttons, checkboxes, mouse clicks, mouse motion, etc. as
long as it is easy to use. (grade: 2 points)
6) Have a “Reset” button that can reset the cube to the initial state, a to 0 and b to 0. (grade: 1 point)
You are required to submit your source codes on eLearning before the due time.
A starting code (c++) animating a cube has been provided. GUI is implemented by AntTweakBar and glut.
To build the code, the following four libraries are needed: GL, GLU, glut (or freeglut), and AntTweakBar.
Please follow the readme.docx document provided along with the codes.
The starting code can be build on cs server: cs2.utdallas.edu
We suggest every student to finish all your assignments on cs server, in which case you do not need to
worry about the library installation and configuration. It will also become easier for the TA to grade your
assignments.
Hints:
1. Every cube transformation can be implemented by modifying the “ModelView” matrix in the
OpenGL code. The ModelView matrix is used to transform the vertex coordinates from world
coordinate system (WCS) to camera coordinate system (CCS).
2. How to rotate the cube around its own z-axis of local coordinate system (LCS)? Here is some hints
that you can consider:
a. Track the direction of the cube’s z-axis of LCS, and represent it in WCS.
b. Construct a rotation matrix, with the rotation axis to be the cube’s z-axis and the rotation
angle to be ‘a’ degrees. Rodrigues’ rotation formula gives the form of this matrix.
c. The rotation pivot point is the origin of cube’s LCS, but not the origin of WCS. Think about
how to make the cube rotate around its own origin.

PlaceholderComputer Animation & Gaming Assignment 1
$30.00
Open chat
Need help?
Hello
Can we help?