PDA

View Full Version : Global Coordinate System Transformations



mbonika
02-27-2000, 03:01 AM
Anyone know of example code that shows how you can maintain transformations along global coordinates even after rotating an object along one of its axis... (e.g. I rotate about the global X-axis, then want to rotate again, but along the global Z-axis, not local). Preferably this should be possible in a hierarchy of objects... The objcts are stored in display lists... And the program is ment to work like a CAD (3ds-Max) application.

Gorg
02-27-2000, 08:14 AM
You use glPushMatrix() and glPopMatrix() do to that:

glPushMatrix();
Rotate aroundx axis
//draw
glPopMatrix(); //old position is used again, so axis are not not rotated
glPushMatrix();
Rotate aroundz axis
//draw
glPopMatrix();

etc.