I just took a look at your transformation matrix code. It seems some of the signs are wrong when you calculate the rotation matrix. I'll take a look later when I'm drunk enough to understand this matrix stuff