title: Jittering when moving mouse
body: <p>I have an opengl program and I am using SDL for the window creating / event handling etc. Now, when I move the mouse to re-position the cameras yaw/pitch, I get a jittering image, with the old position flashing on the screen for a split second.</p>
  
  <p>Now i think this may be an issue with the way I re-position the mouse. I have it set back to the center of the screen at the end of the re-positioning. Here is the said code:</p>
  
  <pre><code>void handleMouseMove(int mouseX, int mouseY)
  {
      GLfloat vertMouseSensitivity  = 10.0f;
      GLfloat horizMouseSensitivity = 10.0f;
  
      int horizMovement = mouseX - midWindowX;
      int vertMovement  = mouseY - midWindowY;
  
      camXRot += vertMovement / vertMouseSensitivity;
      camYRot += horizMovement / horizMouseSensitivity;
  
      if (camXRot &lt; -90.0f)
      {
          camXRot = -90.0f;
      }
  
      if (camXRot &gt; 90.0f)
      {
          camXRot = 90.0f;
      }
  
      if (camYRot &lt; -180.0f)
      {
          camYRot += 360.0f;
      }
  
      if (camYRot &gt; 180.0f)
      {
          camYRot -= 360.0f;
      }
  
      // Reset the mouse to center of screen
      SDL_WarpMouse(midWindowX, midWindowY);
  }
  </code></pre>
  
  <p>Now, Inside my main while loop, here is the SDL code for calling this function:</p>
  
  <pre><code>while( SDL_PollEvent( &amp;event ) )
          {
              if( event.type == SDL_KEYDOWN )
              {
                  if( event.key.keysym.sym == SDLK_ESCAPE )
                  {
                      Game.running = false;
                  }
              }
              if( event.type == SDL_MOUSEMOTION )
              {
                  int mouse_x, mouse_y;
                  SDL_GetMouseState(&amp;mouse_x, &amp;mouse_y);
  
                  handleMouseMove(mouse_x, mouse_y);
              }
  </code></pre>
  
  <p>I found that getting the coordinates like this verses <code>event.motion.x</code> and <code>event.motion.x</code> caused less of this effect.</p>
  
  <p>Any thoughts on how I could avoid this 'jittering' image? </p>