在GraphicsScene中使用Qt GLWidget从图像数据(C ++,Windows)进行快速视频显示? [英] Qt GLWidget in GraphicsScene for fast video display from image data (C++ , Windows)?
问题描述
有一些关于在Qt中更有效地显示视频的问题,而不是将其显示为QLabel。似乎有两种方法:
-
直接写入窗口/窗口小部件的图像缓冲区(但我无法找到有关此信息可以使用Qt,而MSVC / MSC应用程序显然可以写入窗口句柄)
-
使用OpenGL通过硬件显示
由于我目前的方法涉及从填充了我的图像数据的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:
Write directly to a window's / widget's image buffer (but I could not find information whether this is possible with Qt, while MSVC / MSC applications apparently can write to a window handle)
Use OpenGL to display via hardware
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->beginNativePainting
which 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屋!