QGraphicsView with activated OpenGL not faster
-
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);
@
-
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.
-
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..