Synchronous update of Qt3D texture data
-
wrote on 16 Nov 2015, 14:07 last edited by
Use case
I have a
QImage
which needs to be drawn synchronously in 2D (QQuickPaintedItem
) and 3D (rendered as texture on a quad). The contents of theQImage
changes rapidly (like playing a movie).Current solution
Following the Qt3D examples and source code, I'm currently doing the following:
- Subclass
Qt3DRender::QAbstractTextureImage
to represent my texture. My subclass has aQt3DRender::TexImageDataPtr
member that I update with the data from myQImage
. So far so good. - Implement
Qt3DRender::QAbstractTextureImage::dataFunctor()
, which (through a functor) returns myQt3DRender::TexImageDataPtr
member. This works.
Problem
The problem is that the texture loading is asynchronous, and the 3D version of the
QImage
lags significantly behind the 2D version. There seem to be two asynchronous parts contributing to this- The
Qt3DRender::Render::LoadTextureDataJob
, running in a separate thread, checks for updates in my functor, and callsQt3DRender::Render::Texture::requestTextureDataUpdate
, which just marks it as requiring data upload - The
Qt3DRender::QRenderAspect
then comes a long (in the next frame, presumably), and uploads the new data to the GPU texture.
TL;DR
Is there a way for me to synchronously upload data to a Qt3D texture?
- Subclass
-
Hi and welcome to devnet,
Since Qt3D (2.0) is pretty new, I'd recommend asking this question on the interest mailing list. You'll find there Qt3D's developers/maintainers (this forum is more user oriented)
-
wrote on 17 Nov 2015, 08:43 last edited by
Thanks, I'll do that!
3/3