簡體   English   中英

使用OpenGL進行Qt渲染

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM