Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt rendering using OpenGL

Tags:

qt

opengl

qml

I'm working on a QML application for an embedded platform which includes a GridView widget containing images. It's important for me that scrolling through the GridView will be smooth and will not put load on the CPU. Can I expect Qt to use OpenGL to render the GridView?

like image 964
wanderingbear Avatar asked Jun 27 '11 12:06

wanderingbear


1 Answers

I faced with the same problem.

QApplication::setGraphicsSystem(QLatin1String("opengl"));

haven`t work for me. So i set the OGWidget as a viewport:

QDeclarativeView mainwindow;
mainwindow.setSource(QUrl::fromLocalFile("./qml/app.qml"));
QGLFormat format = QGLFormat(QGL::DirectRendering); // you can play with other rendering formats like DoubleBuffer or SimpleBuffer
format.setSampleBuffers(false);
QGLWidget *glWidget = new QGLWidget(format);
glWidget->setAutoFillBackground(false);
mainwindow.setViewport(glWidget);

and do not forget to add opengl in *.pro file.

like image 130
avida Avatar answered Sep 28 '22 01:09

avida