OpenGL flicker on tab switching

opengl

#1

I have multiple components in a TabbedComponent. Each of the components inherits OpenGLRenderer and draws its contents using Open GL. It basically works fine. But the problem is that the view flickers when I switch among them by clicking the tab buttons. I guess it happens because the color buffer is displayed before the first OpenGL rendering have finished (or even have started) after tab switching.

Is there any way to clear the color buffer by a certain color before it is displayed for the first time?