My OpenGL is not more working in Juce Version 6.1.0 (SOLVED)

Hello Juce Team,

Happily clicked to update to the new version (6.1.0). But almost all the code that I have written in OpenGL fell off in the Xcode for mac os/ios project (not tested yet with CMakelist).

How can it be easily fixed ? The OpenGL is difficult for me, I can’t even imagine where to dig. Thanks.

Undefined functions:

        glEnable(GL_BLEND);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

1 Like

I was about to take my first steps with OpenGL and also update to 6.1.0. Having read this I’m wondering if I should do either! I’m keen to know what the thoughts/solutions are here, too.

There were several breaking changes in JUCE recently related to OpenGL:

Each of these changes is documented in the BREAKING-CHANGES.txt file, which is located at the root of the JUCE repository/source code archive.

I hope this helps!

3 Likes

So just a briefly, is that something that was not planned and it’s a bug that will be fixed or is OpenGL slowly being be removed?

Thanks.

It’s neither not planned nor a bug; you have to add the gl namespace to your functions and types to use OpenGL from JUCE. This is because an OpenGL wrangler has been to be able to (dynamically) use all of the OpenGL available on the systems. This also means loading the extensions (the many versions’ functions) manually when you feel it suits your needs (JUCE loaded the extensions by default which slowed down an app’s start-up).

1 Like

Got it. Thanks.

added

using namespace gl;

Works fine now.

@jrlanglois
Hmm, it looks like I was hurry. The project has been compiled fine, but the screen is now just a black screen, instead of my wavetable.

On M1 MacOS - works.
On iOS - not working, blank screen.

Which iOS version are you targeting? Looking at Apple Developer Documentation it appears you need to be within this range:
image

@jrlanglois I used iOS 11. But even if I use 13.0 It still down on the " glResolveMultisampleFramebufferAPPLE"

iPad ver - 14.7.1

@jrlanglois
Hmm, something strange happens. When I disabled the multisampling (setMultisamplingEnabled) the opengl picture is now appeared but the CPU constantly 107-156% in debugging mode. Release - 37-60% and this is even I’m not calling the redraw trigger. Before it was just 0-1% cpu.


        openGLContext.setMultisamplingEnabled(false);
        //OpenGLPixelFormat format;
        //format.multisamplingLevel = 4;
        //openGLContext.setPixelFormat(format);

        openGLContext.setContinuousRepainting(false);
        openGLContext.setComponentPaintingEnabled(false);
        openGLContext.attachTo(*this);




I had a quick peek but I’m not familiar enough with JUCE’s OpenGL ES pipeline to provide further help from here… one of the JUCE devs would have to pitch in! Sorry!

Please could you try replacing glResolveMultisampleFramebufferAPPLE() with ::glResolveMultisampleFramebufferAPPLE() and check whether that resolves the crash?

@reuk

Still crash. Also as I noted above the openGLContext.setContinuousRepainting(false) seems to be not working.

That’s not the change I suggested - could you try with just a :: prefix, rather than gl::, please?

@reuk Yes, in this way it’s work. However, I will just transfer my shaders to 3.2, I think this is not a problem. It remains to decide why it is called constantly redraw(), because I have a setContinuousRepainting(false)

Thanks

OK, thanks for trying that. I’ll get that change merged asap.

1 Like

Any idea why in ver. 6.1.0 the render() runs now in loop ?

i.e. this method is not working anymore for me. And my app In idle, redraws everything that is possible with 120 fps on iPad or 60 fps on mac os.

        openGLContext.setComponentPaintingEnabled(false);

Thanks.

This seems to be a bug. It should be fixed by this patch:

Please try updating to the latest develop and let us know if you encounter further issues.

1 Like

@reuk Thanks that was fast. Confirming it works now.