Hardware Accerlation problem - Viewport(new GLWidget())



  • 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.



  • 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,



  • 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.



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



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



  • [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.



  • 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...



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



  • 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



  • Ok, I'll check that..

    Thank you.

    BR,


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.