title: C++/OpenGL - Rotating a rectangle
body: <p>For my project i needed to rotate a rectangle. I thought, that would be easy but i'm getting an unpredictable behavior when running it..</p>
  
  <p>Here is the code:</p>
  
  <pre><code>    glPushMatrix();
      glRotatef(30.0f, 0.0f, 0.0f, 1.0f);
      glTranslatef(vec_vehicle_position_.x, vec_vehicle_position_.y, 0);
      glEnable(GL_TEXTURE_2D);
      glEnable(GL_BLEND);
      glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
      glBegin(GL_QUADS);
  
          glTexCoord2f(0.0f, 0.0f);
          glVertex2f(0, 0);
          glTexCoord2f(1.0f, 0.0f);
          glVertex2f(width_sprite_, 0);
          glTexCoord2f(1.0f, 1.0f);
          glVertex2f(width_sprite_, height_sprite_);
          glTexCoord2f(0.0f, 1.0f);
          glVertex2f(0, height_sprite_);
  
      glEnd();
      glDisable(GL_BLEND);
      glDisable(GL_TEXTURE_2D);
      glPopMatrix();
  </code></pre>
  
  <p>The problem with that, is that my rectangle is making a translation somewhere in the window while rotating. In other words, the rectangle doesn't keep the position : <code>vec_vehicle_position_.x</code> and <code>vec_vehicle_position_.y</code>.</p>
  
  <p>What's the problem ?</p>
  
  <p>Thanks</p>