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. QOpenGlWidget postredisplay
Forum Update on Tuesday, May 27th 2025

QOpenGlWidget postredisplay

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 897 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.
  • Q Offline
    Q Offline
    QT-static-prgm
    wrote on 18 Jan 2017, 14:51 last edited by
    #1

    Hi,

    i want to change my QOpenGl background Color after init.

    All solutions with a similar problem pointed to this: https://www.opengl.org/resources/libraries/glut/spec3/node20.html
    So i wonder if there is something Qt that does the same. update() does not work

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 18 Jan 2017, 22:18 last edited by
      #2

      Hi,

      Can you show how you are using QOpenGLWidget ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        QT-static-prgm
        wrote on 19 Jan 2017, 09:30 last edited by
        #3

        @SGaist of cause. here is the gl init function and here I change the background color with glClearColor

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 19 Jan 2017, 21:00 last edited by
          #4

          I'd move the call to glClearColor just before calling glClear.

          If you don't want to recalculate it each turn, add a dirty check.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • Q Offline
            Q Offline
            QT-static-prgm
            wrote on 20 Jan 2017, 15:41 last edited by
            #5

            Yeah now it works thank you a lot @SGaist

            Just one thing. The 3D object changes the Color directly when i press on the light button. But the backgound only after i moved the object a bit.
            But in both cases i call update(). Any ideas what makes the different to update() in the mouse move function??

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 20 Jan 2017, 21:15 last edited by
              #6

              Maybe the frameSwapped signal is what you are looking for.

              On a side note, your usage of parentWidget is a bad idea. You are creating a tight coupling and preparing for a nightmare maintenance of your application.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              1/6

              18 Jan 2017, 14:51

              • Login

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