   Rotating 3 squares on their own axis
  Hi,My question probably has a simple answer so please forgive my stupidity...I have 3 squares drawn to the screen, one in the center and one either side.  The squares are made out of quads, and I build them during initialisation only.  In my draw routine I loop through each object and perform:1. LoadIdentity2. Translate (x, y, z)3. Rotate(angle, xv, yv, zv)4. Draw quadSo I want to create an animation that sees each quad rotate along its y axis such that it looks as if it is rotating on a pole - so it doesnt move around the screen but remains static in the x position, and simply rotates.What I get instead is that the 3 squares all rotate around as if they are connected and there is a pole going through the middle of the center square.  I dont know how to change this so each square/quad rotates in-place.Any advice?Thanks,D   
  glLoadIdentity();//cube1glPushMatrix();glTranslatef();glRotatef();Draw();glPopMatrix();//cube2glPushMatrix();glTranslatef();glRotatef();Draw();glPopMatrix();//cube3glPushMatrix();glTranslatef();glRotatef();Draw();glPopMatrix();   ;  MARS_999 is exactly right about the code.  Lets see if I can explain it a little.  What you are doing in your code is translating to a certain point, say P1, for cube one, then rotating the cube.  The cube rotates around it's axis, or P1.For cube two though, your matrix is already set up to rotate around P1, so when you translate cube two to it's location, P2, and then rotate, not only are you rotating the cube around P2(it's axis), you are also rotating around P1.  Since P1 is not the cube's axis, rotating around P1 means that cube 2 orbits around P1.    With cube three you get a similar situation.  So the solution is to have each cube start from the identity matrix, then translate to it's position, then rotate.  glPushMatrix basically saves the current matrix and glPopMatrix loads the former matrix saved by glPushMatrix.  It's actually a little more complicated than this, but that's the general idea.  So now each cube is only being affected by one translation and one rotation.You should probably read up on viewing transformations in OpenGL.  Chapter 3 of the Red Book is a good place to start.  