在GraphicsScene中使用Qt GLWidget从图像数据(C ++,Windows)进行快速视频显示? [英] Qt GLWidget in GraphicsScene for fast video display from image data (C++ , Windows)?

查看:1202
本文介绍了在GraphicsScene中使用Qt GLWidget从图像数据(C ++,Windows)进行快速视频显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一些关于在Qt中更有效地显示视频的问题,而不是将其显示为QLabel。似乎有两种方法:





由于我目前的方法涉及从填充了我的图像数据的QImage创建的QPixmapItem,即使在小的结果(<1 MP,30 Hz)下,我的Core2Duo也报告了40%的负载。 / p>

我想继续使用QGraphicsScene为了显示多个图像/视频,但我不知道是否可以在场景中显示(多个)QGLWidgets - 是吗?

解决方案

也许不是几个GLWidget,而是几个GraphicsItem,调用 painter-> beginNativePainting ,它允许发布openGL命令。



graphicView的视口必须是QGLwidget,后者在构造函数中用QGLFormat(QGL :: SampleBuffers)初始化。
请参阅使用opengl的Qt小部件



当OpenGL活动项目在后台时,情况更简单,因为对glClear的调用也会擦除视口背景,清除下面zorder中的任何项目。


There are a few questions about displaying video more efficiently in Qt than by showing it as QLabel. There seem to be two approaches:

Since my current approach involves a QPixmapItem created from a QImage populated with my image data, even at small resulutions (<1 MP, 30 Hz) my Core2Duo is reporting 40 % load.

I would like to keep using QGraphicsScene in order to show multiple images/videos, but I don't know whether it's possible to show (multiple) QGLWidgets in a scene - is it?

解决方案

Perhaps not several GLWidget, but several GraphicsItem, calling painter->beginNativePaintingwhich allows openGL commands to be issued.

The viewport of the graphicView must be a QGLwidget, the latter initialized with QGLFormat(QGL::SampleBuffers) in the constructor. see Qt widgets using opengl

The case is simpler when OpenGL active item is in the background, because calls to glClear erase the viewport background as well, clearing any item below with a lower zorder.

这篇关于在GraphicsScene中使用Qt GLWidget从图像数据(C ++,Windows)进行快速视频显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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