Seeing that JUCE supports OpenGL 3, it would seem useful to allow users to test it within the demo.
Here’s an explicit initialisation, but probably an option to toggle between the default OpenGL context and 3.2 would be better.
void MainAppWindow::setRenderingEngine (int index)
{
showMessageBubble (getRenderingEngines()[index]);
#if JUCE_OPENGL
if (getRenderingEngines()[index] == openGLRendererName
&& contentComponent != nullptr
&& ! contentComponent->isShowingOpenGLDemo())
{
#if JUCE_OPENGL3
openGLContext.setMultisamplingEnabled (true); //FYI: This can't be called multiply if the current renderer is the same - the method jasserts
openGLContext.setOpenGLVersionRequired (OpenGLContext::openGL3_2);
#endif
openGLContext.attachTo (*getTopLevelComponent());
return;
}
openGLContext.detach();
#endif
if (ComponentPeer* peer = getPeer())
peer->setCurrentRenderingEngine (index);
}
There is something a bit strange about doing this; on my Mac Mini, glGetString (GL_VERSION)
returns 4.1 INTEL-10.22.29
with this 3.2 setting. I guess the native context just picks the latest, making setting the version more of a hint instead? The code looks right: JUCE is setting NSOpenGLProfileVersion3_2Core
, even though NSOpenGLProfileVersion4_1Core
is an option for 10.10 and above. Oh well - if it works, whatever!