[vtk-developers] swap interval and mouse input problems
Clinton Stimpson
clinton at elemtech.com
Mon Nov 30 12:38:57 EST 2015
Hi,
On certain platforms with certain Xlib or OpenGL implementations, I'm seeing
interaction lags when using VTK in Qt applications. I see this with both
QVTKWidget and QVTKWidget2.
With a swap interval = 1 to prevent tearing, the SwapBuffers() can stall, which
can result in mouse input events being queued by the X server.
Here is bug report describing the same issue
https://bugreports.qt.io/browse/QTBUG-39370
It appears the best fix is to request a render in response to high frequency
mouse input, rather than doing a render immediately. This fixes the queuing of
mouse events which can come at a higher frequency than the monitor refresh
rate. This will allow consuming multiple mouse events between a render. This
requesting of renders makes application behavior consistent regardless of the
swap interval setting. However, VTK doesn't appear to have a mechanism for
'requesting' a render.
As an experiment, I changed vtkRenderWindowInteractor::Render to request a
render rather than do one, and then call vtkRenderWindow::Render when an
actual render needs to happen. This fixes the mouse lag problem.
This approach to fixing the problem changes the meaning of Render(), and also
doesn't fit with vtkRenderView::Render(). It seems vtkRenderView could be
changed to rely on vtkRenderWindow's StartEvent event instead of the
interactor's RenderEvent.
Would it make more sense to propose that a new function be added to request a
render? RequestRender()?
Thanks,
Clint
More information about the vtk-developers
mailing list