tags:

views:

78

answers:

2

Hello.

I'm looking for a simple way to draw 3D text on QGLWidget without using FTGL, FreeType, "render to texture" or framebuffer objects, i.e. using documented Qt 4 functions only, no additional libraries.

Ideas?

P.S. "3D text" means that letters are flat and have zero thickness, but can be rotated in 3D space. Think about "Star wars opening crawl" - flat letters positioned in 3D space. ALso, I already to know that I can write my text rendering class that would render glyphs onto texture, etc. I'm looking for simple a way to do the same thing using standard Qt 4 functions. For example, QPainter probably have access to all required data internally.

A: 

Transliterating this tutorial to C++ worked quite well for me.

genpfault
It requires FreeType which may not be compiled into Qt 4. As I said, I was looking for a way to do it using standard Qt 4 functions.
SigTerm
+1  A: 

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'll still need a 2D triangulator.
--EDIT--

So far I have found no other way to render 3D text using Qt only, and no triangulation routines in library. I'm assuming that this functionality isn't implemented in Qt yet.

SigTerm