title: How to draw a rectangle with rounded corners in OpenGL?
body: <p>I'm trying to draw a rectangle using OpenGL with rounded corners (like when using border-radius in css), something like the example below, using OpenGL.</p>
  <p><a href="https://i.stack.imgur.com/UcAdZ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UcAdZ.jpg" alt="enter image description here" /></a></p>
  <p>The initilization</p>
  <pre><code>    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
      glutInit(&amp;argc, argv);
      glutCreateWindow(&quot;Test1&quot;);
   // The callback draw function here
      glClearColor(0, 0, 0, 0);
      glutMainLoop();
  </code></pre>
  <p>The callback draw function</p>
  <pre><code>glClear(GL_COLOR_BUFFER_BIT);
      int x = 0 ;
      int y = 0;
      glBegin(GL_POLYGON);
      glVertex2d(x, y);
      glVertex2d(x, y + 50);
      glVertex2d(x + 100, y + 50);
      glVertex2d(x + 100, y);
      glVertex2d(x, y);
      glEnd();
   glFlush();
  </code></pre>