- {
- GLdouble mm[17], pm[17];
- GLint vp[5];
- GLdouble wx=-1, wy=-1, wz=-1;
- glGetDoublev (GL_MODELVIEW_MATRIX, mm);
- glGetDoublev (GL_PROJECTION_MATRIX, pm);
- glGetIntegerv (GL_VIEWPORT, vp);
-
- /* Convert 3D coordinates to window coordinates */
- gluProject (a->x, a->y, a->z, mm, pm, vp, &wx, &wy, &wz);
-
- /* Fudge the window coordinates to center the string */
- wx -= string_width (mc->xfont1, a->label) / 2;
- wy -= mc->xfont1->descent;
-
- /* Convert new window coordinates back to 3D coordinates */
- gluUnProject (wx, wy, wz, mm, pm, vp, &wx, &wy, &wz);
- glRasterPos3f (wx, wy, wz);
- }
+ /* Before drawing the string, shift the origin to center
+ the text over the origin of the sphere. */
+ glBitmap (0, 0, 0, 0,
+ -string_width (mc->xfont1, a->label) / 2,
+ -mc->xfont1->descent,
+ NULL);