升级xcode到6.1后,跑以前的cocos2dx 2.x写的项目,发现clippingNode失效了。
后来看到这个帖子,解决了我的问题:http://discuss.cocos2d-x.org/t/ccclippingnode-will-raise-error-stencil-buffer-is-not-enabled-when-your-apps-first-draw-use-ccclippingnode/17184/2
下面解法引自上帖:
[[UIApplication sharedApplication] setStatusBarHidden: YES];
// Add this line code, force calling resizeFromLayer, which will actually create the render buffer with depth buffer
and stencil buffer [__glView layoutSubviews];
cocos2d::CCApplication::sharedApplication()->run();
原来只有在初始化第一个场景时创建的clippingNode会失效,貌似是因为在ios8上layoutSubvies的调用时机比以前版本推迟了。
----
参考:http://www.cocoachina.com/bbs/read.php?tid-237138.html