CS 381 HW2--Vectors, Matrices, and Rotations
This homework is based on the "glsl_sliders" program.
You can download a binary for Windows and Linux (Zip, Tar-gzip). You shouldn't have to recompile this program (and in fact, until I post the libraries needed, you can't!).
Turn in your problem vertex program "problem*.txt" files via Blackboard.
Due midnight Thursday, September 14th. WARNING: If your vertex
programs don't compile, you won't get any points! Be sure to try
them out before submitting them!
- Write a vertex program to scale object along the X axis by a
factor of 1.4, shift the object to the left by 0.5, and then scale it
along the Y axis by a factor of 0.3. Name your vertex program
"problem1.txt" when you submit it in Blackboard.
- Write a vertex program to rotate the object counterclockwise
onscreen by 45 degrees. Name your vertex program "problem2.txt"
- Write a vertex program to rotate the object counterclockwise onscreen by
"spin_x" radians, where "spin_x" is a "uniform" variable exported by
the C++ code. Name your vertex program "problem3.txt".
- Write the same rotation vertex program as problem3, but use a
perspective camera where you divide by "v.z+2.0", and use a single mat4
matrix to do *both* the rotation *and* perspective.
Name your vertex program "problem4.txt".
initializing your mat4 with 16 floats is not only ugly, but it doesn't
actually function properly on many graphics drivers. Instead,
it's better to initialize the matrix to zeros with "mat4 m=mat4(0.0);",
assign to column 0's x coordinate (row 0, column 0 of the matrix) with
"mat4.x=...;" and so on for the other nonzero columns and rows. Be
sure to set up the w row correctly!
(Bug fix Saturday afternoon: rotate *counterclockwise*, like the picture,
not *clockwise*, like I mistakenly described above.)
If Blackboard doesn't work for you, or you don't have an account,
you can email this homework to me at email@example.com.
Back to CS 381 Home
Back to CS Home
Back to UAF Home