Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem with renderText function in QGLWidget class
QtWS25 Last Chance

Problem with renderText function in QGLWidget class

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 5.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    durgeshK
    wrote on last edited by
    #1

    I have sub classed QGLWidget in my application and have to annotate my 3D drawing with dimensions. For this i am trying to use renderText() in my application, but the problem i am facing here is that i am unable to render more than one text.

    For example:
    @QString text1 = "Tom n Jerry";
    QString text2 = "Harry Potter";
    renderText(1,1,1,text1);
    renderText(1,0.5,1,text2);@

    When i run it, it just displays "Tom n Jerry", i.e., only the first text. Any solutions?

    1 Reply Last reply
    0
    • F Offline
      F Offline
      Franzk
      wrote on last edited by
      #2

      QGLWidget::renderText is buggy and considered obsolete. Use overpainting as its documentation suggests.

      "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • B Offline
        B Offline
        baysmith
        wrote on last edited by
        #3

        Another way is using a QPainter to draw to a texture which is displayed with quads. This is the approach I use in MIFit. You can see the code here:

        http://gitorious.org/mifit/mifit/blobs/master/libs/opengl/Text.h
        http://gitorious.org/mifit/mifit/blobs/master/libs/opengl/Text.cpp

        Nokia Certified Qt Specialist.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          durgeshK
          wrote on last edited by
          #4

          Thanks Guys, i think i will better use bitmap procedure. renderText is too hard to handle and its rotation is another headache.

          Anyways do you guys have any idea about implementing Drag and Drop feature in openGL application.

          Thanks & Regards
          durgeshK

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved