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. QGraphicsView with activated OpenGL not faster
Forum Updated to NodeBB v4.3 + New Features

QGraphicsView with activated OpenGL not faster

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 3.9k 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.
  • V Offline
    V Offline
    Vaido
    wrote on last edited by
    #1

    Hi!

    I am using the Phonon::VideoWidget within a QGraphicsScene so I can use QGraphicItems as overlays. this is a common procedure first described here:

    http://blog.qt.digia.com/blog/2008/11/28/videos-get-pimped/

    The problem, as described in the article, is that the video is software rendered. To activate hardware rendering one should use the following line of code:

    @view->setViewport(new QGLWidget);@

    My problem is that this doesn't help in my case. With or without this line I have around 40 to 70 percent CPU usage when just playing back a video inside the view.

    Have I missed something? Why isn't OpenGL used in my case?

    Heres the fullcode:

    @

    Phonon::Videoplayer videoPlayer= new Phonon::Videoplayer();

    QGraphicsScene* scene = new QGraphicsScene();

    QGraphicsProxyWidget* proxy= new QGraphicsProxyWidget(0,0);

    proxy->setWidget(videoPlayer);
    QRectF rect = proxy->boundingRect();
    proxy->setPos(0, 0);
    proxy->show();
    scene->addItem(proxy);

    QGraphicsView* view = new QGraphicsView(scene);

    view->setViewport(new QGLWidget);

    view->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);

    @

    1 Reply Last reply
    0
    • R Offline
      R Offline
      rcari
      wrote on last edited by
      #2

      OpenGL does not decode the video, it just does the rasterization of your QGraphicsScene, the final step to "display" the video on screen. You should use some profiling tools to figure where your application is actually spending all this CPU time. My bet would be on the decompression side or something with the texture generation for each video frame.

      1 Reply Last reply
      0
      • V Offline
        V Offline
        Vaido
        wrote on last edited by
        #3

        bq. OpenGL does not decode the video, it just does the rasterization of your QGraphicsScene, the final step to “display” the video on screen. You should use some profiling tools to figure where your application is actually spending all this CPU time. My bet would be on the decompression side or something with the texture generation for each video frame.

        Yes I know. When I playback the video with Windows Media Player I have around 8 to 15 percent CPU usage, so it has to to something with the graphic scene.

        The strange thing is that this 'problem' is known and its usually solved by activating OpenGL for hardware rendering as described in the above article or "here":http://stackoverflow.com/questions/3692712/python-qt-display-text-label-above-another-widgetphonon and some other places..

        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