Graphics animation, OpenGL and... El Capitan


#1

I am so-o-o-o-o pissed (if you'll excuse my French...)

I have wasted a week or so trying to understand why I was not able to do a simple animation (like horizontally moving a small rectangle across the screen at a steady pace) without getting VERY annoying hiccups in the animation. I won't tell you all the things I have tried, from using the animator, to timers, multi-threading, and eventually trying to use OpenGL (which, as we all know is a pain)... I eventually had a closer look at the OpenGLAppExample app and saw that the animation was not as flawless as I initially thought and did have regular "hiccups" too, less easy to see because the rotating teapot was hiding things, much more so than a plain rectangle supposed to move at a regular, steady pace across the screen.

Anyways.

I saw this thread on the forum talking about animation problems with El Capitan and tried my code and also the OpenGLAppExample app on an old MacBookPro with 10.10 (Yosemite) on it and... it worked fine. No hiccups whatsoever, both on my various test apps (using or not OpenGL) and on OpenGLAppExample...

Before I curse Apple forever I would like to know if anyone could make the same comparison playing the OpenGLAppExample under both a 10.11 and 10.10 versions (10.11.1 vs 1.10.2 to be precise) and confirm that there are problems under 10.11.1, and not under 10.10.2.

Please ?

Thanks !

P.S. I am using the latest commits from Juce github

<EDIT> oh and btw I tried the same demo on my old Dell computer running under Win7 and it worked fine too. Incidentally, the teapot is spinning about 5 times faster under Win 7 than under MacOS 10.11...


#2

... it might be easier to see the problem by using a translation. Just modify the getViewMatrix() method in the OpenGLAppExample like so:

    Matrix3D<float> getViewMatrix() const
    {
        Matrix3D<float> viewMatrix (Vector3D<float> (5.0f * std::sin (getFrameCounter() * (0.001f)), 0.0f, -10.0f));

        return viewMatrix;

    }

You might want to use the JUCE_LIVE_CONSTANT macro to play with the sine period, as the OpenGLAppComponent uses setContinuousRepainting mode which obviously will make the code dependent on the hardware you use. Some values make the problem look more obvious than others.


#3

So anybody who can check he/she sees the syndrom under MacOS 11 ?

In the meantime I discovered that if I use the whole screen (setSize (getParentWidth(),getParentHeight());) the problem disappears and the animation is smooth...

Apparently 10.11 seems to have trouble managing the redrawing of the screen with multiple windows ?


#4

It tried your suggested change, but it's completely smooth on my 10.11 machine.

Maybe OSX is doing something specific to the graphics card on your machine? I know that it juggles app priorities depending on what the OS thinks the app is doing, so it could just be an artefact of some policy that depends on the CPU/GPU load that you have.


#5

Damned ! That's what I feared...

Thanks for taking the time and trying it. I switched off the Mac (Mini), physically detached my secondary display, and rebooted the beast.

Still the same thing. Only the app is running, and I still see the hiccups unless I switch to full screen (setSize(getParentWidth(),getParentHeight))... which I assume you didn't do, right ?

I hate this :(


#6

I didn't try full screen, but it was fine running in a window.


#7

What resolution are you running at? I think the minis drop to a 20 or 30 Hz refresh rate at higher resolutions and that might have a bearing on the situation.


#8

Thanx for the idea. But I just tried the app using a guest (minimal) user session and it works fine. So I think it's a software problem and that there is a daemon or whatever in the background that's doing "something" every second or so that makes those hiccups. Very annoying... Can't find anything on the activity monitor (which, btw, creates the same hiccups when refreshing, but that, I can understand). Also, if I make the app use full screen it is smooth again...


#9

No worries, just thought I'd mention it because lower refresh rates seem to unmask some funnies you wouldn't otherwise notice.


#10

If I disable the clock display (with seconds) on my desktop task bar, problem disappears...