How to calculate true rotations for rendering in OpenGL?

41 Views Asked by At

If I want to rotate my object in 3 dimensions x, y and z, it will not rotate correctly because ot these world axis shifts after previous rotations. I know why it is not working like I want, my question is, is there any algorithm which can calculate render rotations based on object rotation values? I tried to implement it by myself of course, but I realized it is not just simple, because for example when I want to calculate Z true rotation value, I need final X rotation value which depends on Z rotation too. So if someone found the algorithm to that I would be very grateful for saving a lot of time I believe.