How can I control the frame rate in Qt 3D?

I am using the new Qt 3D API to render a 3D scene during computationally intensive computing. This scene changes only as a response to user input. However, the default behavior of Qt 3D by default blocks the frame rate of the scene to some high constant value, which in this case consumes an invalid amount of resources.

Is there a way to control frame rate in Qt 3D? Ideally, I would only like to visualize a new frame when changes were made to the scene, but also reduce it to a smaller fixed value. The Qt 3D documentation is sparse, and I could not find a way to do this.

Edit: I managed to find and apply QRenderSettings :: OnDemand to my root node and frame graph, but it does not seem to have an effect, although this implies that it should, since I am using Qt 5.7. Any additional contribution to this would be very welcome (even if it requires only comments).

Editing 2: after installing Fraps and directly measuring the frame rate, it seems that the scene, in fact, only presents frames if necessary using QRenderSettings :: OnDemand. Without this, the frame rate remains at 60 frames per second, which is my screen refresh rate. However , the program continues to consume a lot of CPU time when idling with Qt 3D turned on, regardless of whether a 3D window is displayed. I'm starting to think that this is a separate Qt 3D issue, not related to frame rate, and will probably open a new question accordingly.

+7
c ++ qt 3d frame-rate qt3d
source share
1 answer

The best way to do this is probably to use the FrameRateRange class in the <FrameRateRange> header file. There are two public functions in this class: FrameRateRange() and FrameRateRange(qreal minimumFrameRate, qreal maximumFrameRate) . qreal is a parameter that appears in both parameters of the last function. This is a global typedef declared in the <QtGlobal> header file. minimum and maximum - the frame rate in frames per second. Additional information from here and here .

+2
source share

All Articles