Hi there,
It seems there’s some cache/optimization policy that will resort to outputting opengl rendering at half alpha/brightness when a component’s visibility is enabled under moderate CPU stress.
Anyone experienced with juce/opengl have any similar experiences with some advice for fixes or workaround?
Is this an issue related to a (older) plugin host’s opengl handling?
Thanks for your help.
Details
Workaround Attempts
- Enabling setMouseRepaintsOnActivity successfully undims the dimmed component on mouse enter, but also wrongly dims an undimmed component.
- Forcing manual repaints both on component and opengl as a response to visibility changes doesn’t appear to fix the issue.
- Briefly showing/hiding an overlapping dummy black component as a response to visibility changes doesn’t appear to fix the issue.
Background
The app consists of components that display a simple 2D fragment shader that are shown/hidden dynamically.
- Fragment shaders that ouput shapes are rendered without any transform/scaling, or any issues other than dimming.
- To debug, fragment shaders have been altered output only a simple colour without any calculation (i.e. `out vec4 colour = vec4(1.,0.,1.,1.)).
- Top level component initializes a single OpenGLContext as follows (i.e. there is no dynamic attach/detach):
openGL_context.setOpenGLVersionRequired(OpenGLContext::OpenGLVersion::openGL3_2);
openGL_context.setComponentPaintingEnabled(true);
openGL_context.setContinuousRepainting(true);
openGL_context.setRenderer(this);
openGL_context.attachTo(*this);
- Component::setOpaque() is false and not applicable since Component::paint() is not overidden.
- Component::setBufferedToImage() is false.
- Debug log outputs Component::getAlpha()=false and Component::getCachedComponentImage()=nullptr on both mouseDown() and newOpenGLContextCreated().
Bug
When an opengl shader component is shown with setVisible(true), it will sometimes be shown as significantly dimmed (unsure if it’s alpha or brightness at 50%).
- Only observed when hosted as a plugin – both in Renoise on macOS (VST3) and AUM on iOS (AUv3).
- Showing and hiding an overlapping component (via manual user event) always appears to correctly undim the dimmed component.
- Bug is induced more easily when CPU is higher than normal – is this evidence of juce opengl vs message thread sync issues?
- The Bug appears to be relatively new, i.e. the same opengl app code originated some time in juce 7.xx whereas the current dep is up to date with juce 8.0.8.
Similar Topics
- OpenGL - Multiple Calls to Visibility/Rendering Methods Causes Black Rendering Output - #6 by timart
- Evidence (mentioned above) that fragment shaders are drawn without any issues other than dimming appears to rule out any issues discussed in this thread, i.e. the component rendering the fragment shader is created and closed correctly.
- Multiple OpenGLRenderers (one for each Component) - #4 by 0-matic
- Discussion appears irrelevant as there is no custom async thread rendering going on, all gl rendering is done on the gl thread, and visibility is done on message thread.
