title: Best Practice for Rounded Rectangles in OpenGL ES
body: <p>Using OpenGL ES, there seem to be two viable options for rounded rectangles:</p>
  
  <ol>
  <li>Manually draw the shape using trig. (This is what I'm currently doing.)</li>
  <li>Use a a texture or group of textures that scale appropriately, such as <a href="http://www.centigrade.de/en/blog/article/modern-user-interface-design-tools-part-2-graphical-approach-of-gui-design-tools/" rel="noreferrer" title="9-Slice Scaling">9-Slice Scaling</a></li>
  </ol>
  
  <p>The problem with the first option is that antialiasing does not come for free, and if you are aiming for compatibility with a wide array of devices, one can't count on OpenGL antialiasing hints to actually work on the hardware.  So you're left with choppy-looking rounded rectangles, especially for small ones, and the performance overhead of making another vertex array draw call.  I would like to switch away from this</p>
  
  <p>The second option (9-Slice or 9-Patch) seems to be the go-to method for UI rounded rect elements, but there is surprisingly little information out there about implementing 9-patching in OpenGL ES.</p>
  
  <p>What I would like is: an efficient strategy for rendering antialiased rounded rectangles in OpenGL ES with adjustable border widths, border colors and fill colors.  Any suggestions?</p>