Results 1 to 4 of 4

Thread: RenderText

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2011
    Posts
    203
    Thanks
    7
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default RenderText

    Hi,

    I'm trying to render text in my glwidget:

    Qt Code:
    1. QString text;
    2. text = "TEST test";
    3.  
    4. float x, y, z;
    5. x = 0;
    6. y = 0;
    7. z = 0;
    8.  
    9. float red, green, blue;
    10. red = 1;
    11. green = 0;
    12. blue = 1;
    13.  
    14. QFont font;
    15. font.setFamily("algerian");
    16. font.setPointSize(25);
    17.  
    18. glPushMatrix();
    19. glColor3f(red, green, blue);
    20. renderText(x, y, z, text, font);
    21. glPopMatrix();
    To copy to clipboard, switch view to plain text mode 

    All my experimenting is resulting in clipping of the text:

    1.) If I increase setPointSize beyond a certain point, clipping starts to happen.

    2.) If I change x y z coordinates, clipping happens (this one appears to change the size of the viewport for the text box)

    3.) If I setPointSize to around 15, I get what I'm going to call natural clipping i.e. half of "TEST test" is clipped i.e. you can only see "TEST".

    So it looks like there's like two viewing ports, one for whatever I want to display in paintGL() and one that gets created and pasted on top of the background viewport that contains the text (I'm going to call this 'display box').

    Two questions:

    1.) How do manipulate the 'display box' that contains the text so that I can resize it to any size I want and have it not get clipped?

    2.) How do I move the text around in my window because X Y Z seems to change the dimensions of the 'display box' not actually move the text around in my gl viewing box?
    Last edited by Atomic_Sheep; 14th September 2017 at 13:27.

Similar Threads

  1. problem about renderText
    By tyzhang3 in forum Qt Programming
    Replies: 4
    Last Post: 19th September 2007, 21:35
  2. renderText with background
    By discostu in forum Qt Programming
    Replies: 0
    Last Post: 24th May 2007, 20:09
  3. renderText
    By ToddAtWSU in forum Qt Programming
    Replies: 2
    Last Post: 24th August 2006, 13:29
  4. QGLWidget renderText
    By Rayven in forum Qt Programming
    Replies: 2
    Last Post: 14th July 2006, 21:02
  5. About QGLWidget::renderText
    By showhand in forum Qt Programming
    Replies: 11
    Last Post: 8th March 2006, 13: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.