title: How can I draw a centered string in OpenGL/C++?
body: <pre><code>void DrawGLText(string text, float loc_x, float loc_y) {
    glColor4f(1.0, 1.0, 1.0, 0.5);
    glRasterPos3f(loc_x, loc_y, 1);
    glutBitmapString(GLUT_BITMAP_HELVETICA_18), text.c_str());
  }
  </code></pre>
  
  <p>This is the my code for drawing text at a specific location.  I'd like to adapt it to draw text that's centered on (loc_x, loc_y) rather than left-aligned.</p>