使用OpenGL进行Qt渲染 [英] Qt rendering using OpenGL

查看:215
本文介绍了使用OpenGL进行Qt渲染的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为嵌入式平台开发QML应用程序,该应用程序包括一个包含图像的GridView小部件.对我来说重要的是,在GridView中滚动将是平滑的,并且不会给CPU造成负担.我可以期望Qt使用OpenGL渲染GridView吗?

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?

推荐答案

我遇到了同样的问题.

I faced with the same problem.

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

不能为我工作.所以我将OGWidget设置为视口:

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);

并且不要忘记在* .pro文件中添加opengl.

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

这篇关于使用OpenGL进行Qt渲染的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆