I have object moving from A to B on x-axis and there is no translation of object apart from it. Now, while moving, i want to rotate it around y-axis and the motion should change accordingly, i mean if i rotate it right when moving from -x to +x axis, it should move towards near plane. I have variable in gltranslatef which is modified in the loop after that i have glscalef to scale whole object which is made of hierarchical structure. Now i tried following code to achieve the expected result but its not working properly
glTranslatef(move, 0, 0);
// If I comment these 3 lines, it does not affect the output
glTranslatef(-move, 0, 0);
glRotatef(rotate,0,1,0);
glTranslatef(move, 0, 0);
glScalef(0.2, 0.2, 1.0);