-
Creator 版本:1.8.1
-
目标平台: iOS
前提:
我们的cocos接入iOS平台(不是游戏),不是已启动就直接调用run
问题,我们在第一次打开cocos的内容的时候,正常,退出(调用end())后,再次进入cocos内容,黑屏,报错
代码:
初始化:
CCEAGLView *eaglView = [CCEAGLView viewWithFrame: frame
pixelFormat: kEAGLColorFormatRGBA8
depthFormat: GL_DEPTH24_STENCIL8_OES
preserveBackbuffer: NO
sharegroup: nil
multiSampling: NO
numberOfSamples: 0 ];
[eaglView setMultipleTouchEnabled:YES];
_eaglView = eaglView;
cocos2d::GLView *glview = cocos2d::GLViewImpl::createWithEAGLView((__bridge void*)_eaglView);
cocos2d::Director::getInstance()->setOpenGLView(glview);
run:
cocos2d::Application::getInstance()->run();
退出:
cocos2d::experimental::AudioEngine::uncacheAll();
cocos2d::experimental::AudioEngine::end();
auto director = cocos2d::Director::getInstance();
director->pause();
// 清除缓存
director->stopAnimation();
director->purgeCachedData();
director->getTextureCache()->removeAllTextures();
// director->setDefaultValues();
ScriptingCore::getInstance()->restartVM();
director->end();
报错:
2018-10-23 17:43:17.082951+0800 StoryShip[28312:7763174] cocos2d: surface size: 2208x1242
OpenGL error 0x0501 in -[CCES2Renderer resizeFromLayer:] 146
请问,针对这样非一次性的退出,该如何解决,
现在的我们的保留方案是,cocos不退出,但是cocos占用的内存挺大,而且加载不同资源会叠加,求大神
122674287 可以具体的聊一下