Hello anyone
Iám using windows xp with qt-4.5.2
I have a application with QGLWidget and FTGL
I use this application for 3d font and its works fine.
Its works together with a .ttf file.
I have read the documentation FTGL and its only can be used for fonts or special fonts.
I want to use a Pixmap.
Is it possible to do this.
Must i convert the QPixmap to QBytearray? or something else QBuffer.
This is a piece of my implentation glwidget.cpp
// Set up the FTGL library for 3D text rendering
bool GLWidget::initFTGL() {
font = new FTExtrudeFont("Arial.ttf");
if (font->Error()) {
qDebug("initFTGL(): Could not load font.");
return false;
}
font->FaceSize(14);
font->Depth(1.0f);
return true;
}
// Set up the FTGL library for 3D text rendering
bool GLWidget::initFTGL() {
font = new FTExtrudeFont("Arial.ttf");
if (font->Error()) {
qDebug("initFTGL(): Could not load font.");
return false;
}
font->FaceSize(14);
font->Depth(1.0f);
return true;
}
To copy to clipboard, switch view to plain text mode
In my paintGL()
void GLWidget::paintGL()
{
......
FTBBox rect = font->BBox(cStr.data());
FTPoint p = rect.Upper();
glColor3f(0.0,0.0,0.0);
glRotatef(rot, 0.0f, 1.0f, 0.0f);
glTranslatef(-p.Xf() / 2.0f, -p.Yf() / 2.0f, 0.0f);
font->Render(cStr.data());
}
void GLWidget::paintGL()
{
......
QByteArray cStr = ( QVariant("img/s.png" ) ).toByteArray() ;
FTBBox rect = font->BBox(cStr.data());
FTPoint p = rect.Upper();
glColor3f(0.0,0.0,0.0);
glRotatef(rot, 0.0f, 1.0f, 0.0f);
glTranslatef(-p.Xf() / 2.0f, -p.Yf() / 2.0f, 0.0f);
font->Render(cStr.data());
}
To copy to clipboard, switch view to plain text mode
I only see in my application the text img/s.png not the image
Thanks in advance.
Bookmarks