Integration with MoltenGL?


Hi everyone,

I’m looking to get some assistance with integrating GLFW with MoltenGL on Mac OS. The idea would be to run an OpenGL ES 2.0 natively on Mac.

Now, I already noticed that for both GLFW 3.2.1 and GLFW 3.3, nsgl_context.m will actively check if the the GLFW_OPENGL_ES_API hint is set, and if so, it will refuse to create a window:

if (ctxconfig->client == GLFW_OPENGL_ES_API)
                    "NSGL: OpenGL ES is not available on OS X");
    return GLFW_FALSE;

So perhaps I’m missing something, but am I correct in saying that it is currently not possible to create an OpenGL ES 2.0 context in Mac OS using GLFW, even if you have the OpenGL ES 2.0 dynamic libraries for Mac OS from a vendor such as MoltenGL?


The nsgl_context.m file is for the standard OpenGL desktop API, whereas the ES 2.0 API is handled in another source file.

See the window creation code for the Mac OS platform which shows how each API hint is handled.

As for using MoltenGL I’ve no experience with that myself.

[quick edit:] note that the above means that you might be able to get ES 2.0 working with the MoltenGL ES 2.0 install.


Ok, thank you very much for that insight!

I just double-checked and it seems that the code you reference only exists in 3.3, but not in 3.2.1. In 3.2.1, I only have a call to _glfwCreateContextNSGL, but not EGL or Mesa.

I guess I’ll start by upgrading to the master branch. I’ll let you know what progress I make.