Components repainting with garbage data intermittently

I’m encountering a graphics issue which I’m having trouble solving. I’ve got a lot of details about it, just don’t have the knowledge regarding what to do with that information.

I’ve made my own UI dropdown menus, sliders, buttons, etc. I’m still using juce components for all of that so all the standard repaint and graphics stuff is being used.

I’m encountering a graphics bug that only appears in release mode on the vst3 version when I run it in cubase. I have a custom function for setting my UI objects active and inactive which changes the colors they use when repainting. When their active state changes, the colors are swapped out and component::repaint is called.

Some of my UI objects render garbage data periodically, like random graphics data from other parts of the screen. Toggling the objects active or mousing over them temporarily fixes that since those things trigger repaint. As a side note its the same UI objects every time I run my plugin that have this issue. There are a large number of UI objects of the same type and very few of them have this graphics issue.

At first I thought there must be some issue with my code that changes out the colors of the UI objects, but that makes no difference. I narrowed this down and the issue looks like it just happens on repaint. Things that trigger repaint will intermittently fix the rendering issue and then it reappears again.

The fact that this issue is so specific to certain objects and does not occur in others even though they are objects of the exact same class, and the fact that it’s the same objects having this issue each time leads me to think that there’s some low level graphics thing that I must be interfering with somehow, but I’m not sure where to start.

The last piece of information I’ve got is that random UI objects are repainting constantly even though nothing in my code is triggering that. Like I said, these UI objects are all juce components. Under what circumstances do juce components automatically repaint? And is it possible that a mass of constant repaint commands could interfere with the rendering of other components?

Any information or advice would be much appreciated. Thanks!

In my experience, weird repainting artifacts are often caused by a component that sets setOpaque(true) , but is not actually opaque (not repainting its whole rect, or repainting with alpha transparency).


Hmm. Ya I’ve encountered that before too. Just double checked and I don’t have them set as opaque.

juce always repaints stuff if it overlaps other stuff that needs repainting. you can use setBufferedImage() to mostly only let it repaint on repaint calls, but it only has a performance gain if the paint method is rather complicated

Ahh the overlapping makes sense. Hmm. Well I’m still unsure of how to proceed but if overlapping is triggering the repaints then that at least gives me another angle to approach from.