Details
-
Suggestion
-
Resolution: Won't Do
-
P4: Low
-
None
-
6.0.1
-
None
Description
Hi.
I want render a QQuickWindow to multi custom render target, how do i should it? For a pseudo code example:
class FutureRenderControl : public QQuickRenderControl { public: void render(const QRect &geometry) { Q_D(QQuickRenderControl); if (!d->window) return; QQuickWindowPrivate *cd = QQuickWindowPrivate::get(d->window); if (d->rhi) { if (!d->rhi->isRecordingFrame()) { qWarning("QQuickRenderControl can only render when beginFrame() has been called"); return; } if (!d->cb) { qWarning("QQuickRenderControl cannot be used with QRhi when no QRhiCommandBuffer is provided"); return; } cd->setCustomCommandBuffer(d->cb); } // should add renderSceneGraph(const QRect &geometry) for QQuickWindow cd->renderSceneGraph(geometry); } }; void renderWindow(FutureRenderControl *rc, const QRect &geo) { QOpenGLContext *glOfThread = ...; glOfThread->makeCurrent(...); // This texture can is a Linux GBM buffer of a drm output device, so we can map the QQuickWindow to multi screen at the same time by multi thread. QOpenGLTexture *texture = ...; aBlockOfTexture->bind(); rc->render(geo); } void demo() { auto rc = new FutureRenderControl(); auto window = new QQuickWindow(rc); window->resize(20, 20); // render for part top-left QtConcurrent::run(renderWindow, rc, QRect(0, 0, 10, 10)); // render for part top-right QtConcurrent::run(renderWindow, rc, QRect(10, 0, 10, 10)); // render for part bottom-left QtConcurrent::run(renderWindow, rc, QRect(0, 10, 10, 10)); // render for part bottom-right QtConcurrent::run(renderWindow, rc, QRect(10, 10, 10, 10)); }