Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Hardware Accerlation problem - Viewport(new GLWidget())
Forum Update on Monday, May 27th 2025

Hardware Accerlation problem - Viewport(new GLWidget())

Scheduled Pinned Locked Moved Mobile and Embedded
10 Posts 3 Posters 4.2k 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.
  • Q Offline
    Q Offline
    qtd1d1
    wrote on last edited by
    #1

    Hi,

    somehow the Hardware Accerlation with GLWidget doesn't work.
    I think I am missing something trivial.

    thats how my code looks like:

    @ int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    a.setGraphicsSystem("native");

    QGraphicsScene scene;
    scene.setSceneRect(0.0, 0.0, 500.0, 500.0);
    
    
    QGraphicsView view(&scene);
    view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    
    QGLFormat fmt = QGLFormat::defaultFormat();
    
    fmt.setDoubleBuffer(true);
    fmt.setSwapInterval(1);
    
    QGLWidget* glWidget = new QGLWidget(fmt);
    
    view.setGeometry(0, 0, 500, 500);
    view.setViewport(glWidget);
    
    view.setViewportUpdateMode(
                QGraphicsView::FullViewportUpdate);
    
    view.viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
    view.viewport()->setAttribute(Qt::WA_NoSystemBackground);
    
    
    MainWindow w(&scene);
    
    view.show();
    
    return a.exec();
    

    }@

    The cpu load is still quite heavy (~90 %)

    Does anyone has an idea why it's not working?
    I am using the same settings with a QML/C++ application and it works fine .. with hardware accerlation.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      Thanatos.jsse
      wrote on last edited by
      #2

      I have the same problem.
      I've been testig "this example":http://doc.qt.nokia.com/qq/qq26-openglcanvas.html, but don't work on my archlinux. The line of code:

      @view.setViewport(glWidget);@

      don't work poperly.

      BR,

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        qtd1d1
        wrote on last edited by
        #3

        What kind of hardware do you use? Did you write a display driver by yourself?

        I am using the i.MX53 with the simpleGL display driver.

        1 Reply Last reply
        0
        • Q Offline
          Q Offline
          qtd1d1
          wrote on last edited by
          #4

          I tested my example on Windows XP. It's exactly the same problem.
          I think my problem is somewhere in the code...

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            Do your openGL samples like Gears work properly and hardware accelerated?

            1 Reply Last reply
            0
            • T Offline
              T Offline
              Thanatos.jsse
              wrote on last edited by
              #6

              [quote author="qtd1d1" date="1327678090"]What kind of hardware ...[/quote]

              I'm using a simple Intel chipset with vesa driver, but there is no problem. I have too a Xp 64 and have the same problem.

              When I try to set OpenGL render engine to the QGraphicsView via
              @QGraphicsView::setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers));@

              [quote author="Andre" date="1327699046"]Do your openGL samples like Gears work properly and hardware accelerated?[/quote]
              I'm tested the drivers and OpenGl configuration, the QtOpenGl examples work well.

              1 Reply Last reply
              0
              • Q Offline
                Q Offline
                qtd1d1
                wrote on last edited by
                #7

                Yes, exactly. My drivers work correctly, too. I've tested some QML and Qt Widgets Examples. The Hardware Accerlation is working fine. But I can't get it to go with my own application...

                1 Reply Last reply
                0
                • Q Offline
                  Q Offline
                  qtd1d1
                  wrote on last edited by
                  #8

                  Maybe it's necessary to implement the QGLWidget by your own. I will try that and post the results later

                  1 Reply Last reply
                  0
                  • Q Offline
                    Q Offline
                    qtd1d1
                    wrote on last edited by
                    #9

                    Ok, I solved the problem.

                    It was actually hardware accerlated but, the problem on the target was the caching.
                    I commented this line in my QGraphicsPixmapItem out:

                    @//setCacheMode(DeviceCoordinateCache);@

                    Hope this helps

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      Thanatos.jsse
                      wrote on last edited by
                      #10

                      Ok, I'll check that..

                      Thank you.

                      BR,

                      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