[Interest] Hardware Accerlation problem - Viewport(new GLWidget())

Dietrich.Gossen at continental-corporation.com Dietrich.Gossen at continental-corporation.com
Mon Jan 30 09:45:41 CET 2012


Hi, 
somehow the Hardware Accerlation with GLWidget doesn’t work.
I think I am missing something trivial. 
thats how my code looks like: 
1.         int main(int argc, char *argv[]) 
2.        { 
3.            QApplication a(argc, argv); 
4.            a.setGraphicsSystem("native"); 
5.          
6.            QGraphicsScene scene; 
7.            scene.setSceneRect(0.0, 0.0, 500.0, 500.0); 
8.          
9.          
10.            QGraphicsView view(&scene); 
11.            view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 
12.            view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 
13.          
14.            QGLFormat fmt = QGLFormat::defaultFormat(); 
15.          
16.            fmt.setDoubleBuffer(true); 
17.            fmt.setSwapInterval(1); 
18.          
19.            QGLWidget* glWidget = new QGLWidget(fmt); 
20.          
21.            view.setGeometry(0, 0, 500, 500); 
22.            view.setViewport(glWidget); 
23.          
24.            view.setViewportUpdateMode( 
25.                        QGraphicsView::FullViewportUpdate); 
26.          
27.            view.viewport()->setAttribute(Qt::WA_OpaquePaintEvent); 
28.            view.viewport()->setAttribute(Qt::WA_NoSystemBackground); 
29.          
30.          
31.            MainWindow w(&scene); 
32.          
33.            view.show(); 
34.            
35.            return a.exec(); 
36.        } 
The cpu load ist steally 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. 

Dietrich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120130/ed6b95f9/attachment.html>


More information about the Interest mailing list