How to accelerate the frame rate of a CView

Hello, I know there are already discussions about this topic, but since they are old I just wanted to ask again, if there is a best practice how to accelerate the redrawing frame rate of a CView? We tried some hacks already, but none of them worked. Interestingly, when setting the view invalid() in its onMouseMoved() function, it really increases the frame rate inherently. But this only works as long as you move the cursor. I tried triggering invalid() from another frequent thread (processing thread), but it has no effect. So, just a timer running with 60 Hz setting the view invalid does not seem to work?

Hi,
you’re on Windows right? Which version? It’s an important detail to know.
And what is the runtime value of CView::kDirtyCallAlwaysOnMainThread in your plug-in?

Hi Arne, I am working together with Joscha on that topic, so I can answer that for you:
We are currently working with VSTGUI 4.6, though an update to a more current version is on the plan.
Also, we tested that on Windows (10.0.19041) but Mac is of course relevant for us aswell.
CView::kDirtyCallAlwaysOnMainThread is set to false.

OK, if you can guarantee that you only call into VSTGUI from the UI thread, you should set the CView::kDirtyCallAlwaysOnMainThread to true somewhere in your code. If you cannot guarantee that, you should refactor your code to do that.
Now whenever you call CView::setDirty or CView::invalid the system will issue a repaint of that area as fast as possible.
If this does not fix the issue, you should check that you actually call CView::invalid with a frequency of 60Hz.

1 Like

CView::kDirtyCallAlwaysOnMainThread = true seems to do the trick. Thanks a lot!