Results 1 to 9 of 9

Thread: QGLWidget renderText()

  1. #1
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default QGLWidget renderText()

    I have a graph draw inside a QGLWidget and display grid lines and their values on the screen. I have x-values and y-values. Whenever I scroll the grid up and down the graph moves smoothly. But whenever I scroll the graph left or right, it slows up and lags whenever the text gets to the right edge of the screen. It speeds back up when the text is completely moved off the screen until the next number moves to the edge when it again slows up. Does anyone have any ideas why this does this? I am just using renderText() and it only slows up whenever text gets to the left side of the screen. Thanks again!

  2. #2
    Join Date
    May 2006
    Location
    Bangalore
    Posts
    23
    Thanks
    3
    Thanked 4 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QGLWidget renderText()

    Can we see your code related to renderText()?
    The Keyboard Is Mightier Than The Sword!

  3. #3
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Post Re: QGLWidget renderText()

    Qt Code:
    1. for( int i = 0 ; i < (xMax - xMin) / xStepSize ; i++ )
    2. {
    3. //point = some number discovered higher up
    4. //xMin = the value of the first number to be printed next to the gridline
    5. //xStepSize = the distance to the next grid line.
    6. renderText( (xMin + i * xStepSize, 0.01, QString::number( point[i] ) );
    7. }
    To copy to clipboard, switch view to plain text mode 

    I just run this through a for-loop while updating the int variable point. The numbers display in the correct place, its just the movement is jerky everytime a grid line/number approaches the right edge and only a portion of the text from renderText( ) displays. Hope this helps! Thanks!

  4. #4
    Join Date
    May 2006
    Location
    Bangalore
    Posts
    23
    Thanks
    3
    Thanked 4 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QGLWidget renderText()

    [QUOTE=ToddAtWSU]
    Qt Code:
    1. for( int i = 0 ; i < (xMax - xMin) / xStepSize ; i++ )
    2. {
    3. renderText( (xMin + i * xStepSize, 0.01, QString::number( point[i] ) );
    4. }
    To copy to clipboard, switch view to plain text mode 

    BTW, your renderText has mismatching brackets.

    I have a doubt regarding your problem.
    There are 2 signatures in renderText() available in Qt.
    Qt Code:
    1. renderText ( int x, int y, const QString & str, const QFont & fnt = QFont(), int listBase = 2000 )
    2. renderText ( double x, double y, double z, const QString & str, const QFont & fnt = QFont(), int listBase = 2000 )
    To copy to clipboard, switch view to plain text mode 

    It seems like you have been using the first signature ( the one with int x and int y)...
    I feel that you intended to use the second signature because you are using 0.01 as your Y value.

    But to your original problem of slow translation I can't find any good reason why your text slows your translations so much. It doesn't do the same with me. If you figure out a solution on your own, please post it.
    Last edited by bits; 27th June 2006 at 19:11. Reason: To mention about mismatching brackets
    The Keyboard Is Mightier Than The Sword!

  5. #5
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QGLWidget renderText()

    Thanks...I did not notice the first signature for renderText was using 2 ints. I just saw it only had an x and y coordinate so I used that since my z=0. But I will change that to see if it helps at all. If I do find a solution I will definately post it. But I might try to go another route and just create a QLabel and update it's text to match my grids. Thanks!

  6. #6
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QGLWidget renderText()

    I am still having problems with the text slowing up my moving of the graph. Has anyone else run into this problem? Thanks!

  7. #7
    Join Date
    Jan 2006
    Location
    Third rock from the sun
    Posts
    106
    Thanks
    17
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QGLWidget renderText()

    Check the version of the Nvidia drivers being used. I had some trouble with using the newest drivers and OpenGL, and had to switch to the legacy drivers.

  8. The following user says thank you to Rayven for this useful post:

    ToddAtWSU (21st July 2006)

  9. #8
    Join Date
    Jan 2006
    Location
    Paris, France
    Posts
    227
    Thanks
    3
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QGLWidget renderText()

    Hello !

    I have a problem with this method, on a Win32 system : my strings aren't displayed, and I grab this warning message :

    warning : QGLContext::generateFontDisplayLists: Could not generate display lists for font 'Arial'

    This message is always thrown, for any font I can specify...

    Worse, the Qt example Sample Buffers that uses renderText(), works correctly... and I don't do anything specific
    in my OpenGL code..
    I have no problem at all with Linux / X11.

    Any idea, or anyone experienced this ?

    Thanks,
    Guilugi.

  10. #9
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Talking Re: QGLWidget renderText()

    Thanks Rayven that worked!

Similar Threads

  1. about QGLWidget and QPainter
    By showhand in forum Qt Programming
    Replies: 5
    Last Post: 12th November 2008, 11:45
  2. QGLWidget updateGL()
    By Lele in forum Qt Programming
    Replies: 7
    Last Post: 30th May 2006, 16:08
  3. Replies: 1
    Last Post: 8th May 2006, 08:07
  4. QGLWidget renderText problem
    By mbjerkne in forum Qt Programming
    Replies: 1
    Last Post: 7th April 2006, 22:35
  5. qGLWidget
    By mickey in forum Newbie
    Replies: 8
    Last Post: 24th February 2006, 01:30

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.