[Qt-interest] Custom QGLWidget as viewport for QGraphicsView
Ed Sutton
ESutton at fescorp.com
Tue Mar 9 21:59:41 CET 2010
>(How *does* one quantifiable measure real time latency like that - e.g. event happens in front of camera to the time it displays on screen?
A crude way that will give you a *rough* idea:
1. Get a stop watch or timer running with hundreds of seconds accuracy or better. ( I think the iPhone stop watch only has 0.1 second resolution. )
2. Place stop watch next to your software running your video display and point your video camera at the running stop watch.
3. Take a picture with a camera with both the video display and the physical stopwatch in frame and compare the differences between physical and displayed.
Issues:
Frame rate of video camera, video screen refresh rate, etc.
I am also using a widget derived from QGLWidget that renders a video frame decoded to a bitmap as a 2-D texture. This is very fast as it uses the NVidia hardware acceleration. However, all I am simply displaying video with some text drawn on top. It sounds like you are doing something more complicated.
-Ed
On Mar 4, 2010, at 12:49 PM, Josiah Bryan wrote:
Hey all -
How can I do my own performance sensitive painting as the background for
a QGraphicsView? What, drawBackground() you say? Ummm...performance is
terrible with that. Specifically, low-latency updates are very difficult
to achieve. For example, when trying to render a video stream from a
live camera (from a PCI capture card) in drawBackground(), the latency
is quite noticeable - I'd say anywhere from 100ms - 300ms latency (e.g.
for lip sync with audio or eye blinking.)
Now, the same video stream rendered to a dedicated widget derived from
QGLWidget renders with virtually no perceptible latency - I'd say less
than 100ms if I had to guess. (How *does* one quantifiable measure real
time latency like that - e.g. event happens in front of camera to the
time it displays on screen? Right now, I test it by seeing if I can see
my self blink on screen - silly, I know - but it's fairly good judge of
latency.)
However, trying to render in drawBackground() gives terrible performance
- less than 1 frame every several seconds! I've optimized QGraphicsView
using every possible optimization I can think of - setCachdeMode to
none, render hints, viewport update mode, optimization flags, and of
course, setting a plain QGLWidget as a viewport - nothing speeds up
rendering. Even a plain repaint() or update() does NOTHING - I have to
call scene()->update() to get the drawBackground() method to be called
again.
My last thought is to try a custom QGLWidget (the one that works fine)
as the viewport for the QGraphicsView so that QGV can draw the items on
top of the QGLWidget - but that doesn't seem to do anything. The custom
QGLWidget never gets to paint anything.
Any ideas or advice?
Thanks!
-josiah
--
-=-=-=-=-=-=-=-=-=-=-=-=-
Josiah Bryan
Productive Concepts, Inc.
jbryan at pciint.com<mailto:jbryan at pciint.com>
(765) 964-6009, ext. 224
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
-Ed
More information about the Qt-interest-old
mailing list