How change the state

hi there!

I m in trouble with Opengl…
have task to rotate a text ( for instance: matata) and have to rotate it on it s own axes and also to each letter on its . I have to achieve without using the Rotatef function . I have used y’=ysin(angle)…
this formulas actually I have designed them seperately but I cant combine them…
pls do me favor with helping how to translate the x,y,z to new x’,y’,Z’
my prethanx

the formula for sferic coordinates is:
x=r*cos(a)cos(b)
y=r
cos(a)sin(b)
z=r
sin(a)(I think)