BR: OpenGL is using a lot of CPU

Don’t even bother trying. It’s not a JUCE bug but rather totally normal behavior of WGL.
Also wglMakeCurrent(nullptr, nullptr) is necessary to guarantee functionality and to free the GL context for other processes. Read this:

This is also not a JUCE specific behavior. Last time I checked it was doing exactly the same in a raw win32 application and other media layer APIs like SDL. Although I think SDL throws in some sleep(frame_delta) stuff to mitigate it a bit. But this is not advised, since it will be worse for multi threaded processes like audio plugins.

In short: wglMakeCurrent is an inherently very heavy operation on Windows. The API call is not suited at all for multi threaded processes. The Vulkan API is much better in that regard, since it was designed for this kind of context/swapchain image acquisition.

1 Like