利用QPainterPath算出polygon之後,就可以畫出邊框
QPainterPath path;
path.addText(QPointF(0, 0), QFont("Arial", 100), QString::fromUtf8("你要不要喝紅茶ˊ_>ˋ?"));
GLuint id = glGenLists(1);
glNewList(id, GL_COMPILE);
foreach(QPolygonF polygon, path.toSubpathPolygons()){
glBegin(GL_LINE_LOOP);
foreach(QPointF point, polygon){
glVertex3f(point.rx(), -point.ry(), 0);
}
glEnd();
}
glEndList();
最後再利用glu提供的tessellation功能,繪出文字