[英]Qt rendering using OpenGL
我正在为嵌入式平台开发一个QML应用程序,其中包含一个包含图像的GridView小部件。 对我来说重要的是滚动GridView将是平滑的并且不会在CPU上加载。 我可以期待Qt使用OpenGL来渲染GridView吗?
我遇到了同样的问题。
QApplication::setGraphicsSystem(QLatin1String("opengl"));
对我不起作用。 所以我将OGWidget设置为视口:
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);
并且不要忘记在* .pro文件中添加opengl。
取决于您的平台使用
QApplication::setGraphicsSystem(QLatin1String("opengl"));
或(Symbian)
QApplication::setGraphicsSystem(QLatin1String("openvg"));
在实例化QApplication对象之前。
默认情况下,Qt不使用OpenGL渲染后端。 您可以使用QGlWidget强制执行它。 在您的情况下,由于您要使用stock小部件,可以将渲染后端设置为命令行选项:
<binary name> -graphicssystem opengl
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.