Adaptive fps / ProMotion and teapot-Demo / still micro stuttering

In Juce-Teapot “OpenGL Demo” the rotation needs a time-dependent factor, if not the rotation is very uneven on new MacBook Pros M1 Max, because it has an adaptive frame-rate, here is the fix

    auto now=Time::getMillisecondCounterHiRes();
    if (! controlsOverlay->isMouseButtonDownThreadsafe())
        rotation += (float) (rotationSpeed * ((now-lastTime) * 60. / 1000.));

This patch includes the benchmark functionality which was proposed by @attila (2.5 KB)

So here is the interesting part:

If I run the benchmark, it shows acceptable values.

But the animation is still stuttering (If you look at it physically) , which will be more visible if you have do some something like a scrolling-waveform.

The same code (as also the teapot-time) runs very smooth on my 9 year old retina-macbook pro.
I have this confirmed multiple times. So my customers with latest hardware generation have the worst results :-/

If would be cool, if someone form the juce-team can confirm this and run the tea-pot demo on the new MacBook Pro M1 Max (latest tip, with the fix) and look physically on it.

I have seen quite smooth animation from other plugin-vendors, so I hope there is still room for improvement with OpenGL in JUCE on Apple M1 Max.

@reuk @attila

Has been adaptive fps considered when designing the openGL in JUCE?

Could it be because of synchronisation issues between Waitable-event and CVDisplayLink.
What happens if the redraw happens directly in the displayCallback?

Would be cool if anybody can check the openGL smoothness on a MacBook Pro M1 Max with their own eyes (not only through benchmark), its not optimal yet.


I did a quick test. With this patch, instead of triggering the repaintEvent(), renderFrame will directly called from the DisplayLink-Callback.

Subjectively, the results are somewhat better, but I can’t rule out the possibility that I’m wrong, not a really breakthrough.
Maybe its just MacOS itself or the new GPU itselfs, which delays the drawing operations a very little bit. (956 Bytes)

If anybody can confirm these micro-stutterings on MacBook Pro M1 Max, I would be happy.

1 Like