title: OpenGL draw rectangle outline
body: <p>I am trying to draw a rectangle with 4 lines (left one). But no matter how I draw (strip, loop, plain lines) the result is the right side one - it is missing pixels at the corners.</p>
  
  <pre><code>|||||||||||     ||||||||||
  |         |    |          |
  |         |    |          |
  |||||||||||     ||||||||||
  </code></pre>
  
  <p>Is there a way to get the left hand side result?</p>
  
  <p>EDIT</p>
  
  <p>Can't post code since it depends a lot on the underlying framework, but all draw calls are nothing more than glDrawElements with index buffer pointing to 4 vertices, no alpha tests.</p>
  
  <p>After fiddling with coordinates as suggested arrived at this interesting result (iOS simulator):</p>
  
  <p><img src="https://i.stack.imgur.com/uobO7.png" alt="sample"></p>
  
  <p>Notice only upper left corner is missing pixels for some rectangles... 
  All rectangles are drawn in GL_LINES mode within single draw elements call. No other things are drawn.</p>
  
  <p>EDIT 2</p>
  
  <p><a href="http://www.opengl.org/archives/resources/faq/technical/rasterization.htm" rel="noreferrer">OpenGL FAQ</a> question 14.100 states that </p>
  
  <blockquote>
    <p>OpenGL doesn't provide a mechanism to cleanly join lines that share common vertices nor to cleanly cap the endpoints.</p>
  </blockquote>