OpenGL 2D rendering RED on resize

I got the same problem as jakemumu.
Even though I attached my GL context using mGLContext.attachTo(*this) I get false for isContextActive in the resized function.

Here is how I could solve it instead:
I subclass juce::OpenGlRenderer. And in its renderOpenGl() function I put this:

void MyOpenGlRenderer::renderOpenGL()
{
    if (OpenGLHelpers::isContextActive())
    {
         OpenGLHelpers::clear(Colours::blue);
    }
}

Now I only have to tell my GL context, that I am using a custom renderer, by calling:

mGLContext.setRenderer(&mMyOpenGlRenderer);

Seems to work fine so far (fingers crossed)!

1 Like