My task: to calculate the pixel coordinates (for example, to take a picture) of a three-dimensional grid in order to find the 2D shape of this grid from a specific camera angle.
I am currently using Qt3D with a QGeometryRenderer to render a scene containing a grid into a QWidget that works fine. I tried to display the contents of QWidget in Pixmap with QWidget :: render () suggested by this post How to create a screenshot of QWidget? . Saving pixmap in .jpg results in a blank image with the default background color, which makes sense because QWidget does not hold the mesh object itself.
This is how the scene is set in my mainwindow.cpp
As for the rendering here, this is the custommeshrenderer class, where the QGeometryRenderer is defined, and when the grid is initialized, QEntity * is returned.
What is the best way to access the framebuffer, or is there any other way to take a snapshot of the grid?
My last hope was to implement a rendering pipeline (at least from projection coordinates to pixel coordinates), but I would prefer a different solution. Unfortunately, I have to rely on Qt3D and cannot switch to other classes such as QOpenGLWidget. At least I have not yet found the opportunity to integrate it.
I am new to Qt3D, and the lack of detailed documentation does not make it easier.
source share