title: Border around texture, OpenGL
body: <p>This is a code I use to draw rectangle in my program:</p>
  
  <pre><code>glBegin(GL_QUADS);
      glTexCoord2f(0.0f, maxTexCoordHeight);              glVertex2i(pos.x, pos.y + height);
      glTexCoord2f(0.0f, 0.0f);                           glVertex2i(pos.x, pos.y);
      glTexCoord2f(maxTexCoordWidth, 0.0f);               glVertex2i(pos.x + width, pos.y);
      glTexCoord2f(maxTexCoordWidth, maxTexCoordHeight);  glVertex2i(pos.x + width, pos.y + height);
  glEnd();
  </code></pre>
  
  <p>It draws just a simple rectangle with specified texture, e.g. like this: <img src="https://i.stack.imgur.com/c2UDP.png" alt="enter image description here"></p>
  
  <p>I'd like to ask if it's possible in OpenGL to achieve border effect like this:
  <img src="https://i.stack.imgur.com/SZ39G.png" alt=""></p>
  
  <p>As you see inside this tile there's just a plain blue background which could be handled separately - just automatically resized texture. This can be achieved easily with a code snippet I gave, but the problem is with border. </p>
  
  <p>If the border was supposed to be one color, I could try drawing empty, not-filled rectangle by using <code>GL_LINES</code> around my texture, but it's not.</p>
  
  <p>Also if tiles were always with a fixed size, I could prepare a texure that would match it, but they HAVE TO be easily resizable without changing a bitmap file I use as texture.</p>
  
  <p>So if it's not possible with basic OpenGL functions, what are the approaches to achieve this effect that would be most efficient and/or easy?</p>
  
  <p>EDIT: It has to be 2D.</p>