Transform and Rotate an Object at the same time

I’m really a newbie to openGL, So maybe need your help to fininsh my project.

Here I wanted to write a code that include five planes, I can move these all together, right or left. When the mouse choosed the middle plane which is in the middle of the window, this plane moves front a lot so it seems bigger. when moving, it also rotate 180° slowly, when moving stop, the angle is just 180.

When moving and rotate the plane, I use function of “glTranslatef” and “glRotated”. But when use these two functions at the same time, it always wrong.

I do not know how to deal with it. Can you give me some good advices?
Thank you very much!

The final transformation depends on the order in which glRotate*() and glTranslate*() functions are called. If you want to rotate object around its center, then do something like this:

glTranslatef(…);
glRotatef(…);
DrawObject(…);

But if you want to rotate that object around some other point, then you have to do something like this:

glTranslatef(…);
glRotatef(…);
glTranslatef(…);
DrawObject(…);

The translation just above DrawObject() should move the object away from the rotation point.

For further information refer to the Red Book (OpenGL Programming Guide) or any similar book.