Results 1 to 3 of 3

Thread: QPixmap

  1. #1
    Join Date
    Jan 2006
    Posts
    115
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QPixmap

    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
    Qt Code:
    1. // Set up the FTGL library for 3D text rendering
    2. bool GLWidget::initFTGL() {
    3. font = new FTExtrudeFont("Arial.ttf");
    4. if (font->Error()) {
    5. qDebug("initFTGL(): Could not load font.");
    6. return false;
    7. }
    8. font->FaceSize(14);
    9. font->Depth(1.0f);
    10. return true;
    11. }
    To copy to clipboard, switch view to plain text mode 

    In my paintGL()

    Qt Code:
    1. void GLWidget::paintGL()
    2. {
    3. ......
    4. QByteArray cStr = ( QVariant("img/s.png" ) ).toByteArray() ;
    5. FTBBox rect = font->BBox(cStr.data());
    6. FTPoint p = rect.Upper();
    7. glColor3f(0.0,0.0,0.0);
    8. glRotatef(rot, 0.0f, 1.0f, 0.0f);
    9. glTranslatef(-p.Xf() / 2.0f, -p.Yf() / 2.0f, 0.0f);
    10. font->Render(cStr.data());
    11. }
    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QPixmap

    I don't think you can render a pixmap using a font renderer, this seems to be a misunderstanding of either OpenGL or FTGL. But you can use an image as a texture and render it on some quad.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jan 2006
    Posts
    115
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QPixmap

    Thanks for your reply.
    I have already an image as texture on a different cubes.

Similar Threads

  1. Replies: 4
    Last Post: 28th August 2008, 13:13
  2. Replies: 1
    Last Post: 21st August 2008, 07:44
  3. QPixmap bug under Qt4.3.1 ?
    By Nyphel in forum Qt Programming
    Replies: 8
    Last Post: 7th October 2007, 17:04
  4. Replies: 5
    Last Post: 9th April 2007, 14:26
  5. What's faster: QPixmap-to-QImage or QImage-to-QPixmap
    By forrestfsu in forum Qt Programming
    Replies: 2
    Last Post: 15th December 2006, 17:11

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.