Rotation problem

I am writing a software that can load and display 3D models and can pan, rotate and zoom.

I’m implementing rotation and translation in such a way that wherever I pan the object, it always rotates around the center of the screen(like it should) using rotation first then translation.

When i dont rotate or rotate the object around Y axis the object can pan right, left, up and down easily by simple geometric calculations.

The problem starts here.

when the object is rotated along the X axis or Z axis then I cant seem to figure out how to make the object pan on the screen in UP, down,left and right direction. I cant figure out how to use sin or cos for this…

I can make it move left and right but top /down starts having problem.

can anyone help me with this? Is my approach wrong and is there a better approach.

Using sin and cos for what?
What is wrong with something like

glRoatate // set the angle to move object
glTranslate // move object
glRotate // rotate object around itself