Results 1 to 2 of 2

Thread: QFont:Handle() usage?

  1. #1
    Join Date
    Jun 2008
    Posts
    1

    Question QFont:Handle() usage?

    I'm trying to render text in a QGLWidget, but I need render from OpenGL, not from QGLWidget methots.

    I need to use native WGL, GLX OpenGL text rendering, using wglUseFontBitmaps and glXUseXFont.

    I found in the past (1999) a message:
    **********************************

    Hi!

    Some time ago i asked how to use this stuff under win32.

    Here is the example how to use it:


    int listid;
    QFont aFont(font);

    #ifndef WIN32
    unsigned long glFont;
    glFont = (unsigned long)aFont.handle();
    #else
    HDC glFont;
    glFont = qt_display_dc();
    #endif

    listid = glGenLists(1);
    if(listid != 0)
    {
    #ifndef WIN32
    glXUseXFont(glFont,32,96,listid);
    #else
    wglUseFontBitmaps(glFont,32,96,listid);
    #endif
    }

    qt_display_dc() seem to be a bit ugly - but it works!

    Bye
    Bernd

    **********************************

    my code:
    **********************************

    GLuint Offset;
    QFont aFont = wOver->getFont(i);

    #ifndef WIN32

    Font glFont;

    glFont = aFont.handle();

    #else

    HDC glFont;

    glFont = wImag->getDC();

    #endif



    if(fontOffset[contextoActual][i] == -1)

    {

    Offset=glGenLists((GLsizei)lastfont);
    #ifndef WIN32

    glXUseXFont(glFont,firstfont,lastfont-firstfont+1,Offset+firstfont);

    #else

    wglUseFontBitmaps(glFont,firstfont,lastfont-firstfont+1,Offset+firstfont);

    #endif

    fontOffset[contextoActual][i]=(int)Offset;
    }
    glListBase((GLuint)fontOffset[contextoActual][i]);

    glFinish();

    **********************************


    Using QFont::handle() in my code is returnig 0 (glfont is 0 and aFont is a valid QFont ) that was an invalid handle and then glXUseXFont don't work.

    Has someone any idea of how to do it in qt4.4??

    Thanks and Regards!

  2. #2

    Default Re: QFont:Handle() usage?

    I am struggling with the same issue, have you found any answers?

    Thanks,

    Fred

Similar Threads

  1. Reducing CPU Usage
    By Kapil in forum Qt Programming
    Replies: 8
    Last Post: 3rd April 2011, 14:43
  2. QEffects.cpp usage.....
    By Naveen in forum Qt Programming
    Replies: 6
    Last Post: 11th January 2011, 11:07
  3. CPU and Memory Usage
    By philwinder in forum Qt Programming
    Replies: 16
    Last Post: 17th May 2008, 22:25
  4. QPersistentModelIndex usage info request
    By defumar in forum Qt Programming
    Replies: 3
    Last Post: 18th January 2008, 15:40
  5. How to determine memory usage?
    By nopalot in forum General Programming
    Replies: 3
    Last Post: 11th February 2007, 19:50

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.