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

Pritam pritam_ghanghas at infosys.com
Tue Jan 31 11:49:49 CET 2012


On Monday 30 January 2012 02:15 PM, 
Dietrich.Gossen at continental-corporation.com wrote:
> 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_ 
> <http://developer.qt.nokia.com/doc/QApplication.html>a(argc, argv);
> 4.    a.setGraphicsSystem("native");
> 5.
> 6. _QGraphicsScene_ 
> <http://developer.qt.nokia.com/doc/QGraphicsScene.html>scene;
> 7.    scene.setSceneRect(0.0, 0.0, 500.0, 500.0);
> 8.
> 9.
> 10. _QGraphicsView_ 
> <http://developer.qt.nokia.com/doc/QGraphicsView.html>view(&scene);
> 11.    view.setHorizontalScrollBarPolicy(_Qt_ 
> <http://developer.qt.nokia.com/doc/Qt.html>::ScrollBarAlwaysOff);
> 12.    view.setVerticalScrollBarPolicy(_Qt_ 
> <http://developer.qt.nokia.com/doc/Qt.html>::ScrollBarAlwaysOff);
> 13.
> 14. _QGLFormat_ <http://developer.qt.nokia.com/doc/QGLFormat.html>fmt 
> = _QGLFormat_ 
> <http://developer.qt.nokia.com/doc/QGLFormat.html>::defaultFormat();
> 15.
> 16.    fmt.setDoubleBuffer(true);
> 17.    fmt.setSwapInterval(1);
> 18.
> 19. _QGLWidget_ <http://developer.qt.nokia.com/doc/QGLWidget.html>* 
> glWidget = new _QGLWidget_ 
> <http://developer.qt.nokia.com/doc/QGLWidget.html>(fmt);
> 20.
> 21.    view.setGeometry(0, 0, 500, 500);
> 22.    view.setViewport(glWidget);
> 23.
> 24.    view.setViewportUpdateMode(
> 25. _QGraphicsView_ 
> <http://developer.qt.nokia.com/doc/QGraphicsView.html>::FullViewportUpdate); 
>
> 26.
> 27.    view.viewport()->setAttribute(_Qt_ 
> <http://developer.qt.nokia.com/doc/Qt.html>::WA_OpaquePaintEvent);
> 28.    view.viewport()->setAttribute(_Qt_ 
> <http://developer.qt.nokia.com/doc/Qt.html>::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
>

I dont know why GLWidget is not working for you. I dont see anything 
wrong there.
But "a.setGraphicsSystem("native"); " is not doing anything.
It should be called before application construction to have any effect .

-- 
Regards,
Pritam


**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely 
for the use of the addressee(s). If you are not the intended recipient, please 
notify the sender by e-mail and delete the original message. Further, you are not 
to copy, disclose, or distribute this e-mail or its contents to any other person and 
any such actions are unlawful. This e-mail may contain viruses. Infosys has taken 
every reasonable precaution to minimize this risk, but is not liable for any damage 
you may sustain as a result of any virus in this e-mail. You should carry out your 
own virus checks before opening the e-mail or attachment. Infosys reserves the 
right to monitor and review the content of all messages sent to or from this e-mail 
address. Messages sent to or from this e-mail address may be stored on the 
Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120131/af710ca0/attachment.html>


More information about the Interest mailing list