Cocos2d-x vs. Cocoa app on Mac OS (dealing with NSOpenGLView in XIB)

Is there any good sample/tutorial of linking cocos2d-x with Cocoa application (with NSOpenGLView configured in Interface Builder)?

I’m trying to link it manually, looking at Cocos Builder sources (with cocos2d-iphone). But cocos2d-x has significant differences in Director and differs from cocos2d-iphone. At this moment some OpenGL functions (such as glClear(), glFlush()) work, but when drawing nodes INVALID_VALUE error occurs.

Would be thankful for help.