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 drawing text by QOpenGlFunctions
Qt 6.11 is out! See what's new in the release blog

Problem with drawing text by QOpenGlFunctions

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 2.1k Views 1 Watching
  • 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.
  • ataryqA Offline
    ataryqA Offline
    ataryq
    wrote on last edited by ataryq
    #1

    Hi all!
    I have some problem with drawing text by QOpenGlFunctions.
    QOpenGlFunctions vs QGraphicsItem
    See img:
    OpenGlTest.png
    QGraphicsItemTest.png

    //your code here
    if (!m_device) m_device = new QOpenGLPaintDevice;
    m_device->setSize(size());
    QPainter painter(m_device);
    painter->drawText(QPoint(100, 200), "Hello world!");
    How can I solve this problem? Where can I dig? I look forward to any proposal.
    Sorry for my bad English, please write if it have mistakes.

    Answer:
    problem is solving by clearning buffer

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @ataryq said:

      OpenGlTest.png
      QGraphicsItemTest.png

      should these have been links to images?

      ataryqA 1 Reply Last reply
      0
      • mrjjM mrjj

        @ataryq said:

        OpenGlTest.png
        QGraphicsItemTest.png

        should these have been links to images?

        ataryqA Offline
        ataryqA Offline
        ataryq
        wrote on last edited by
        #3

        @mrjj yes, thanks

        mrjjM 1 Reply Last reply
        0
        • ataryqA ataryq

          @mrjj yes, thanks

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @ataryq
          btw did u try with
          painter.setRenderHint(QPainter::Antialiasing);

          ataryqA 1 Reply Last reply
          0
          • mrjjM mrjj

            @ataryq
            btw did u try with
            painter.setRenderHint(QPainter::Antialiasing);

            ataryqA Offline
            ataryqA Offline
            ataryq
            wrote on last edited by
            #5

            @mrjj no, problem is solving by clearning buffer

            glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
            
            1 Reply Last reply
            1

            • Login

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