1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

DemoRunner: Avoid attempting to nest OpenGL contexts

OpenGL contexts normally can't be nested. Previously, when the main
renderer for the DemoRunner was set to OpenGL, we would forcibly reset
the engine to the software renderer when displaying any heavyweight
demo, including the OpenGL demos.

19061e6d introduced a regression, where the rendering engine was no
longer reset on Windows, so displaying an OpenGL demo while the global
renderer was also set to OpenGL would cause an assertion to fire in the
OpenGL Graphics context, after which rendering would fail.

With this change in place, we now fall back to the Direct2D renderer,
instead of the software renderer, when displaying a heavyweight demo.
This commit is contained in:
reuk 2025-05-15 16:23:52 +01:00
parent 2f0b287ce7
commit b15b65decf
No known key found for this signature in database

View file

@ -286,11 +286,13 @@ MainComponent::MainComponent()
if (isHeavyweight)
{
#if JUCE_MAC && USE_COREGRAPHICS_RENDERING
setRenderingEngine (1);
#elif ! JUCE_WINDOWS
setRenderingEngine (0);
#if (JUCE_MAC && USE_COREGRAPHICS_RENDERING) || JUCE_WINDOWS
constexpr auto fallbackEngine = 1;
#else
constexpr auto fallbackEngine = 0;
#endif
setRenderingEngine (fallbackEngine);
}
isShowingHeavyweightDemo = isHeavyweight;