cocos2dx--3.2退出程序的时候不要清空纹理缓存

前端之家收集整理的这篇文章主要介绍了cocos2dx--3.2退出程序的时候不要清空纹理缓存前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1. CCPlatformMacros.h 中CC_ENABLE_CACHE_TEXTURE_DATA 安卓中定义为0


2. javaactivity.cpp中nativeInit中注释一些内容

void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env,jobject thiz,jint w,jint h)
{
auto director = cocos2d::Director::getInstance();
auto glview = director->getOpenGLView();
if (!glview)
{
glview = cocos2d::GLView::create("Android app");
glview->setFrameSize(w,h);
director->setOpenGLView(glview);

cocos_android_app_init(env,thiz);

cocos2d::Application::getInstance()->run();
}
else
{
;
//cocos2d::GL::invalidateStateCache();
cocos2d::GLProgramCache::getInstance()->reloadDefaultGLPrograms();
//cocos2d::DrawPrimitives::init();
//cocos2d::VolatileTextureMgr::reloadAllTextures();

//cocos2d::EventCustom recreatedEvent(EVENT_RENDERER_RECREATED);
//director->getEventDispatcher()->dispatchEvent(&recreatedEvent);
//director->setGLDefaultValues();
}

}


原文链接:https://www.f2er.com/cocos2dx/344485.html

猜你在找的Cocos2d-x相关文章