If you see flickering when you resize the window, you can try this:
class MainWindow : public DocumentWindow, private Timer
{
public:
MainWindow (String name) : DocumentWindow (name, juce::Colours::lightgrey, DocumentWindow::allButtons)
{
startTimer(100); // to avoid white flickering when starting the application
}
void timerCallback() // to avoid flickering when resizing the window
{
_openGLContext.attachTo(*getTopLevelComponent());
stopTimer();
}
void resized() override
{
_openGLContext.detach(); // to avoid flickering when resizing the window
DocumentWindow::resized();
startTimer(100); // to avoid flickering when resizing the window
}
I hope it helps somebody.