I am rendering a mesh on screen, and when the user presses a button I am rendering a black square to a texture and then the mesh to the texture. After this I am firing up a compute shader that performs image processing on the "snaphot". My question is: How to do the rendering exactly once?
These are the steps I need to perform:
- Render black square to texture (to clear texture)
- Render geometry to texture (to take a snapshot of it so I can process it)
- Start compute shader with texture as input
I am able to perform the compute shader exactly one time using the trigger(1) command (technically this was not straightforward though : https://bugreports.qt.io/browse/QTBUG-86493).
However, how do I render the black square and then the mesh (step 1&2) to a texture exactly one time? Ideally I would like to start the compute shader just after step 1&2 are finished, and it is important that step 1&2 stop being executed after step 3 is executed, or else the result from 3 will be overwritten, and this is the problem I am facing now in my qt3d application.
I guess I could just set the property on the qt3d entities to true, and then to false, and then start the compute shader. But how do I know when to set enabled back to false? If I do it too early, they might get turned on and off before they have had time to get rendered.