3D text in QGLWidget in Qt 4.6.3

I'm looking for an easy way to draw 3D text on QGLWidget without using FTGL, FreeType, texture rendering or framebuffer objects , that is, using only registered Qt 4 functions, no additional libraries,

Ideas?

PS "3D text" means that the letters are flat and have zero thickness, but can rotate in three-dimensional space. Think of the Star Wars Opening Circuit - flat letters placed in three-dimensional space. Also, I already know that I can write a text rendering class that will display glyphs on a texture, etc. I'm looking for an easy way to do the same, using standard Qt 4 functions. For example, QPainter probably has access to all the required data.

+3
source share
2 answers

Found something.

picture

QPainterPath path;
glDisable(GL_LIGHTING);
QFont font("Arial", 40);
path.addText(QPointF(0, 0), QFont("Arial", 40), QString(tr("This is a test")));
QList<QPolygonF> poly = path.toSubpathPolygons();
for (QList<QPolygonF>::iterator i = poly.begin(); i != poly.end(); i++){
    glBegin(GL_LINE_LOOP);
    for (QPolygonF::iterator p = (*i).begin(); p != i->end(); p++)
        glVertex3f(p->rx()*0.1f, -p->ry()*0.1f, 0);
    glEnd();
}
glEnable(GL_LIGHTING);

But it looks like I still need a 2D triangulator.
--edit -

3D- Qt . , Qt.

+6

++ .

0

Source: https://habr.com/ru/post/1760363/


All Articles