Goal: With Qt3D (C++), render my scene offscreen, use render capture on it,
and save image to disk.

With my Qt3DWindow-based solution the scene looks fine and I can do the
render capture part (on macOS anyways - Windows doesn't work for me -
https://bugreports.qt.io/browse/QTBUG-61223 ).

Now I need to be able to do it offscreen (without the window open).

I thought this was going to be as simple as setting a QOffscreenSurface as
my forward renderer surface - something like:

   QOffscreenSurface *surface = new QOffscreenSurface;

   surface->create();

   Qt3DExtras::QForwardRenderer  *forwardRenderer = new
Qt3DExtras::QForwardRenderer;

   forwardRenderer->setSurface( surface );
   forwardRenderer->setExternalRenderTargetSize( QSize( 800, 600 ) );

   qDebug() << surface->format() << surface->size() << surface->isValid();

While this gives me a valid surface and the format is correct, its size is
always (1,1) and the render capture gives me images of that size.

How do I set the size of the QOffscreenSurface?

Or am I going about this the wrong way?

(It would be nice to have a class like the Qt3DWindow one specifically for
offscreen rendering.)

---
Andy Maloney  //  https://asmaloney.com
twitter ~ @asmaloney <https://twitter.com/asmaloney>
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to