title: Rotation around a pivot point with OpenGL
body: <p>I am trying to rotate an object about one of its side and already tried the common approach as found on the forums:<br/></p>
  
  <pre><code>translate(-P);
  rotate();
  translate(P);
  </code></pre>
  
  <p>In <code>OpenGL</code> (reversing the order of translations/rotations), I used the following code:<br/></p>
  
  <pre><code>glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  glPushMatrix();
      glTranslatef(-50, 50, 0);
          glRotatef(rotationCoord, 0, 1, 0);
      glTranslatef(50, -50, 0);
      glBegin(GL_QUADS); 
          glVertex3f(-50.0, 50.0, 0);
          glVertex3f(50.0, 50.0, 0);
          glVertex3f(50.0, -50.0, 0);
          glVertex3f(-50.0, -50.0, 0);
      glEnd();
  glPopMatrix();
  </code></pre>
  
  <p>However, the rectangle that I am drawing doesn't seem to be rotating around one side as pivot.  (trying to set the left side as the pivot point and rotate around it). I made a screen capture  vid to show what kind of rotation I am getting right now. Here's the video:<br/></p>
  
  <p><a href="http://youtu.be/VgEZ_rsG3xU" rel="nofollow">http://youtu.be/VgEZ_rsG3xU</a></p>
  
  <p>How do I set the pivot for this object so that it rotated around that point?</p>