I actually succeeded in implementing a Qt3D widget. It can be found here: https://github.com/florianblume/qt3d-widget.
Unfortunately, I had to use Qt3D's internal classes so it kind of feels a bit unstable because it might break with certain Qt versions. I would have liked to leave all processing loops to Qt3D internally but now have to drive them myself, which also feels a bit not so nice. Anyways, I hope some other people can make use of it, too! Best, Florian On 02.09.20 12:01, Florian Blume wrote: > Hey, > > thanks for your quick answer! > > I actually had the version you described first running. I obtained the > rendered image using QRenderCapture and then displayed it on the quad. > > I also already had the second idea that you described but thought it > should be possible to obtain the texture from Qt3D and use it in OpenGL > that's why I hadn't > investigated this any further. > > Unfortunately, it's pretty difficult to run the aspect engine manually. > I tried to place a processFrame() call in paintGL() - and even placed a > doRender() call to > the AbstractRenderer of the QRenderAspectPrivate after it like this: > > d->m_aspectEngine->processFrame(); > > glClearColor(1.0, 1.0, 1.0, 1.0); > glDisable(GL_BLEND); > glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); > > Qt3DRender::QRenderAspectPrivate *dRenderAspect = > static_cast<decltype(dRenderAspect)> > > (Qt3DRender::QRenderAspectPrivate::get(d->m_renderAspect)); > Qt3DRender::Render::AbstractRenderer *renderer = dRenderAspect->m_renderer; > renderer->doRender(true); > > Without the doRender() call it gets stuck the second time processFrame() > is called - in > Qt3DRender::Render::VSyncFrameAdvanceService::waitForNextFrame() where it > tries to acquire a semaphore (which apparently doesn't have any more > work ready). > > With the doRender() call it gets stuck in a similar place - but in the > first call to paintGL in Qt3DRender::Render::Renderer::isReadyToSubmit() > where it again tries to > acquire a semaphore. > > I also don't understand whether it's enough that QOpenGLWidget binds a > framebuffer before calling paintGL, it looks like in Scene3DRenderer > this is enough to make > Qt3D draw to that framebuffer. > > As you can see there are a lot of open questions which are difficult to > answer. Do you have any suggestions where/how to look for answers? > Obviously in the code itself, > which is also difficult. > > Any help is appreciated, > Florian > > > On 01.09.20 18:28, Mike Krus wrote: >> Hi >> >> Qt 3D source code has an example of how to use render capture in the manual >> tests. >> >> However this is probably not the right way to do it as 1/ it would require >> another FBO on top of the one QOpenGLWidget uses already; 2/ it transfers >> the image to the CPU which is not needed here. >> >> Think the way to do it is to do something similar to what is done for >> Scene3D: >> - setup Qt 3D engine to be in manual mode (rather than using the simulation >> loop) >> by calling QAspectEngine::setRunMode(QAspectEngine::Manual) >> - use QOpenGLWidget and in the paintGL method call >> QAspectEngine::processFrame() >> to have Qt 3D draw >> >> There’s of course lots of other stuff to setup. Might need a dummy offscreen >> surface to handle sizing, handling of the context, and a fair amount more. >> >> Mike >> >>> On 1 Sep 2020, at 16:51, Florian Blume <florian.bl...@tu-berlin.de> wrote: >>> >>> Hi, >>> >>> I'm trying to implement a Qt3D widget since createWindowContainer is not >>> suitable for me (always draws the Qt3DWindow on top of everything). >>> I've already asked a Stackverflow question >>> (https://stackoverflow.com/questions/63686309/use-qt3d-offscreen-rendered-texture-in-opengl) >>> because I ran into >>> several issues trying to display an offscreen texture that I render to >>> with Qt3D in a QOpenGLWidget (it simply doesn't display anything). >>> >>> Has anyone some other solution regarding a Qt3D widget? >>> >>> Best regards, >>> Florian >>> _______________________________________________ >>> Interest mailing list >>> Interest@qt-project.org >>> https://lists.qt-project.org/listinfo/interest >> — >> Mike Krus | mike.k...@kdab.com | Senior Software Engineer >> KDAB (UK) Ltd., a KDAB Group company >> Tel: UK Office +44 1625 809908 Mobile +44 7833 491941 >> KDAB - The Qt Experts, C++, OpenGL Experts >> >> > _______________________________________________ > Interest mailing list > Interest@qt-project.org > https://lists.qt-project.org/listinfo/interest _______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest