rotation,translation in local

The problem goes like that:
Rotation - Pressing and dragging the right mouse button, all objects in the scene will rotate around their center . This means that if initially the object was not centered at (0, 0), you will have to calculate its center (by averaging the x and y coordinates) and make the appropriate transformation before rotating the object.

All directions are in the local object coordinate system. This means that initially, before any rotations are applied, moving the mouse to the right will make the objects move to the right as well. Once the objects are rotated, their coordinate system is rotated as well. This means that making a translation in the X coordinate, for example, will not cause the object to move to the right. Instead it will move in the direction of its own X direction.

For one object in the scene it is easy:
each time I call display() I do


But the problem is that I have many objects
in my scene and thay have different mid_points.

the same but all the transforms with respect
of the global (worlds) coord’ system

How can I solve it without using matrix staff
and just glRotate,glTranslate funcs ???

Thank you

When you get round to reading the replies to your other posts, you’ll see that it has already been answered. Just to make sure :


for( each object in scene )
glTranslate( The position of the object );
glTranslatef( midpoint_x, midpoint_y,0.0f );
glRotatef( The Rotation Amount );
glTranslatef(-midpoint_x,-midpoint_y,0.0f );