OpenGL on linux extremely slow

I’m trying to incorporate OpenGL to draw stuff faster. Following this Tutorial, I made it to the point where my component is showing a black screen, as nothing is rendered into the OpenGL context yet.

However, this is where everything comes to a grinding halt: The GUI now runs at 0.1 FPS, even dragging the window is impossible. This is directly tied to the OpenGLComponent being shown, when hiding it, everything seems to work as usual.

When using the JUCE Demorunner App I can sometimes click the various OpenGL demos, but around half the time clicking any will freeze the Demorunner.

I am running

  • Debian 11
  • JUCE 6.0.8
  • NVIDIA driver 460.91.03 (Gtx 970)

Any help appreciated!

I tested some more and it seems the same code is running fine on Windows and marginally better, yet still pretty bad on Ubuntu 18.04.

Can you run top to see CPU load?
Also have you sync to vblank On or Off in the nvidia-settings?

1 Like

Hi Kott,

sync to vblank was enabled on my Ubuntu machine, disabling it fixes the issue! I will see if this holds true on my Debian machine as well later today.

What does this option do? From the tooltip it reads:

When enabled, OpenGL applications will swap buffers during the vertical retrace.

Any downside to disabling it?

Thanks for your solution! :slight_smile:

Can’t speak from any direct experience with JUCE, but historically the reason for syncing to vertical blank in computer graphics is to avoid “tearing”, since the update should happen during the vertical blanking period whilst the beam isn’t visible (this is a term from CRT displays though, I’m not exactly sure how it applies with flat panels).

1 Like

Ah, It’s v-sync!

Good I was right, but this is not a solution.
Now if you run top you may see that your example takes whole core of CPU. And enabling Graphics API Visual Indicator (in nvidia-settings) shows tens thousands of FPS.

I found that in Vital synth and in recent Waveform (11.5.18 12.0.xx) with GTX 970 and GTX 660.
Now i’m on old Radeon and that issue is partially here, Vital seems fine, but Waveform has always stalled GUI with OpenGL render.

It needs a real hardware to reproduce, yes.

Yes, I can confirm this is exactly what’s happening!
So this sounds like the problem is known at this point?

Yeah, I thought it was app/config specific problem. Now it has more than one confirmation, thank you for that!