How to check if rendering is done/ready

Is there a way to check if rendering is done/ready (vtkRenderer & vtkRenderWindow)? I’m calling Render very frequently, and the GPU basically falls behind a bit which introduces a lag. What I’d like to do is have an if statement before my Render call, so that it only gets called if it’s ready to Render. Thanks!

Mike

If you’re working in Python, you could try to overwrite the Render call to keep track of the status:

import vtk

class MyRenderWindow(vtk.vtkRenderWindow):
    def __init__(self, **args):
        super(MyRenderWindow, self).__init__(**args)
        self._is_ready = True

    @property
    def is_ready(self):
        return self._is_ready

    def Render(self, **args):
        self._is_ready = False
        vtk.vtkRenderWindow.Render(self, **args)
        self._is_ready = True

Then use it like:

...
ren_win = MyRenderWindow()
...
if ren_win.is_ready:
    rend_win.Render()

Unless I’m not understanding something, wouldn’t this just tell me when the Render call has happened? What I need to know is when the GPU is actually done with the Render (which can take longer than the Render call). The Render call sends instructions/requests to the GPU, and then the GPU handles them as fast as it can. But it can easily fall behind if you’re calling Render very frequently. So what I need is a way to know if the GPU is done with the previous Render call.