Synchronous update of Qt3D texture data
I have a
QImagewhich needs to be drawn synchronously in 2D (
QQuickPaintedItem) and 3D (rendered as texture on a quad). The contents of the
QImagechanges rapidly (like playing a movie).
Following the Qt3D examples and source code, I'm currently doing the following:
Qt3DRender::QAbstractTextureImageto represent my texture. My subclass has a
Qt3DRender::TexImageDataPtrmember that I update with the data from my
QImage. So far so good.
Qt3DRender::QAbstractTextureImage::dataFunctor(), which (through a functor) returns my
Qt3DRender::TexImageDataPtrmember. This works.
The problem is that the texture loading is asynchronous, and the 3D version of the
QImagelags significantly behind the 2D version. There seem to be two asynchronous parts contributing to this
Qt3DRender::Render::LoadTextureDataJob, running in a separate thread, checks for updates in my functor, and calls
Qt3DRender::Render::Texture::requestTextureDataUpdate, which just marks it as requiring data upload
Qt3DRender::QRenderAspectthen comes a long (in the next frame, presumably), and uploads the new data to the GPU texture.
Is there a way for me to synchronously upload data to a Qt3D texture?
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)
Thanks, I'll do that!