Qt OpenGL Rendering text issue QGLWidget

c++, opengl, qt, rendering

Solution

I had the exact same problem when using Helvetica. Changing the font to Arial solved it.

I did a small wrapper around it to make things easier:

void _draw_text(double x, double y, double z, QString txt)
{
    glDisable(GL_LIGHTING);
    glDisable(GL_DEPTH_TEST);
    qglColor(Qt::white);
    renderText(x, y, z, txt, QFont("Arial", 12, QFont::Bold, false) );
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_LIGHTING);
}

Problem

I'm using QGLWidget and this code to draw a text on the screen but the rendering is catastrophic if the string's length is too high : Here's my code : ``` glPushMatrix(); glRotatef(90, 0, 0, 1); QString qStr = QString("Here's a very long string which doesn't mean anything at all but had some rendering problems"); renderText(0.0, 0.0, 0.0, qStr); glPopMatrix(); ```

Original source