title: Tearing in OpenGL?
body: <p>I'm using win32 and opengl and I have a window set up with the projection at glOrtho of the window's coordinates. I have double buffering enabled, tested it with glGet as well. My program always seems to tear any primitives that I try to draw on it if it's being constantly translated. </p>
  
  <p>Here is my OpenGL initialization function: </p>
  
  <pre><code>glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
  
  glViewport(0, 0, 640, 480);
  glMatrixMode(GL_PROJECTION);
      glLoadIdentity();
      glOrtho(0, 640, 0, 480, 0, 100);
  
  glMatrixMode(GL_MODELVIEW);
      glLoadIdentity();
      glDrawBuffer(GL_BACK);
  
  glLoadIdentity();
  </code></pre>
  
  <p>And this is my rendering function, gMouseX and gMouseY are the coordinates of the mouse:</p>
  
  <pre><code>glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  
  glTranslatef(gMouseX, gMouseY, 0.0f);
  glColor3f(0.5f, 0.5f, 0.5f);
  glBegin(GL_TRIANGLES);
      glVertex2f(0.0f, 128.0f);
      glVertex2f(128.0f, 0.0f);
      glVertex2f(0.0f, 0.0f);
  glEnd();
  
  SwapBuffers(hDC);
  </code></pre>
  
  <p>The same tearing problem occurs regardless of how often the rendering function runs. Is there something I'm doing wrong or missing here?</p>