float m[16],angle;
glGetFloatv(GL_MODELVIEW_MATRIX,m);
angle = atan2(m[12],m[14])*180.0/M_PI;
glRotate(angle, 0.0, 1.0, 0.0);
You might try swapping m[12] and m[14], or inverting, or adding 90/180/270 to the angle value...
I just made this up off the top of my head, so maybe it''s totally wrong...
