OpenGL in Audio Plugins - Current State


Hello everybody,

I am confused about what the state of the OpenGL implementation for audio plugins is. I see people post that it works for them. I for myself have to do some code changes to make the OpenGLContext attach at all due to a missing peer and no associated screen object. Then still the rendering runs but the OpenGL fbo is not rendered. Component painting works as expected.

I would be great if someone could clarify what the current state of the OpenGL implementation is. Should it work for audio plugins or not?

I use the PluginHost demo, Reaper 64 and Cubase 32 to test my plugins all with the result that OpenGL rendering does not work. When I build a standalone version it works as expected.

So I really do not know if something is wrong on my end or not. I updated to JUCE 4.2 which let to the same results I had before.

I spent almost the whole week on getting OpenGL to work for audio plugins with little success so far. The rendering thread is running and the render functions are called but no OpenGL output is visible in the hosted window.

Thanks in advance


you inherit your plugineditor from :

public OpenGLRenderer

then you add the functions :

void newOpenGLContextCreated() override { };
void renderOpenGL() override { };
void openGLContextClosing() override { };

and private object :

OpenGLContext glContext;

and in constructor :

        if (ComponentPeer* peer = getPeer())
            peer->setCurrentRenderingEngine (0);


Thank you Jake for your reply. This is basically my setup. I changed my code so it matches yours exactly, but the issue remains. If this is all that is needed to render OpenGL in an audio plugin then the issue must be on my side although I have already stripped down the code a lot to get to the source of the problem and the steps you suggest are basically the same steps I am doing.

Also when I use that code without my changes to OpenGLContext the context can never be attached because getPeer() will always return nullptr which is checked by canBeAttached() --> isShowingOrMinimised().


I created a debug editor which I return now with the same result.

`class DebugOpenGLAudioProcessorEditor : public juce::AudioProcessorEditor, public juce::OpenGLRenderer

juce::OpenGLContext _context;


DebugOpenGLAudioProcessorEditor(juce::AudioProcessor *processor) :
	setSize(400, 300);


	if (juce::ComponentPeer* peer = getPeer())
		peer->setCurrentRenderingEngine (0);

virtual void paint(Graphics &g) override
	//g.fillAll(juce::Colours::red);  // this will render on top of OpenGL

virtual void newOpenGLContextCreated() override { }

virtual void renderOpenGL() override
	// paint it green
	glClearColor(0.0f, 1.0f, 0.0f, 1.0f);

virtual void openGLContextClosing() override { }



Anyway I am not so much looking for someone who tells me what is wrong but for an official confirmation if OpenGL is considered to be fully supported in audio plugins. If so then I probably have to take another step back to find my problem. If not then I might just go back to software rendering.

@jules could you take a second and let me know what the current state is on the OpenGL implementation?


It is fully supported.

There is an issue with certain intel based openGL cards (onboard ones, primarily), but that is an unavoidable edge case.


Okay thank you guys. I got it working now and could also remove my hacks. Thank you very much.