Hello,
Im having an small problem i cant figure out (my math skills are not very good).
I want to rotate an sphere with the mouse.
The following code works with one axis:
1 2 3 4 5
| float xdelta = (float)(Math.cos(Math.toRadians(rx))); float zdelta = (float)(Math.sin(Math.toRadians(rx)));
glRotatef(rx,0f,1f,0f); glRotatef(ry,xdelta,0f,zdelta); |
where rx = x rotation (mouse input)
ry = y rotation (mouse input)
however this has odd results when both rx and ry != 0.
So my question is: how to rotate an 3d rotation matrix?