# 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!).
1. 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. 2. Write a vertex program to rotate the object counterclockwise onscreen by 45 degrees.  Name your vertex program "problem2.txt" for submission. 3. 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". 4. 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.
• WARNING: 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);", then 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! 