OpenGL Context locking on Mac

HI,

I have recently upgraded to cocos2d-v3.2 and I am currently having a problem in Mac.

In version 2.x before calling CCDirector::mainLoop, CCDirectorCaller did this:

[openGLView lockOpenGLContext];
// run the main cocos2d loop
cocos2d::CCDirector::sharedDirector()->mainLoop();
...
[openGLView unlockOpenGLContext];

As you can see, before the actual render, the opengl context got locked and after that it was unlocked.

In version 3.x we have this

while (!glview->windowShouldClose())
{
    ...
    director->mainLoop();
    glview->pollEvents();
    ...
}

There is no lock/unlock between render calls.

Since you are now using glfw, the only time the context is locked is when it is created, in _glfwPlatformMakeContextCurrent.

Therefore you are not locking the NSOpenGLContext everytime there is interaction with OpenGL. This can lead to problems when there are other parts of the application that make use of OpenGL in the same thread.