“gimbal lock” results of a misundertand that euler angles are three successive world space rotation and that they should be used to set an object in one pos not to animate it.
Usually you will set an objet in world space using euler rotations + one translation like :
rotateX(rx),rotateY(ry),rotatZ(rz) or as you said glRotated(-90,1,0,0); + glRotated(90,0,1,0); + glRotated(90,1,0,0);
but ususally you will not increase or decrease one of your euler angle to rotate your object because increasing one euler angle doesn’t always means to rotate around the corresponding axis.
=> like increasing RY doesn’t mean you rotate around local axis Y but rather around world axis Y
this is the same for the translation increasing TZ move along Z world axis not Z local axis, and for example to move an object forward (along its Z axis) you will have to use its local axis, not its Z translation, the same apply for rotations.
so for example you can set an objet in any world pos using two ops (used a lot by 3d software studios):
rotate(rx,ry,rz)
translate(px,py,pz)
but you will ususally not directly modify any of thoses 6 values rx,ry,rz,px,py,pz (cause they dont represent something really logical as you would expect) but rather you will use object local axis to rotate or translate this object.
if you want to rotate or move the object around its axis you have to compute its local axis on world :
O(0,0,0);
AX(1,0,0);
AY(0,1,0);
AZ(0,0,1);
O.translate(px,py,pz)
AX.rotate(rx,ry,rz)
AX.translate(px,py,pz)
AY.rotate(rx,ry,rz)
AY.translate(px,py,pz)
AZ.rotate(rx,ry,rz)
AZ.translate(px,py,pz)
//here you can rotate around local axis by rotating around AX, AY or AZ
//or move using AX-O,AY-O,AZ-O
so in conclusion usually :
=> euler is used to set an objet in one pos / store its pos
=> axis to “animate” rotate around any axis