发现重新切回界面会调用 cocos2d::VolatileTextureMgr::reloadAllTextures();
当把 CC_ENABLE_CACHE_TEXTURE_DATA = 1 改为 0 ,需要注释掉上面一段代码,这时游戏彻底黑屏了。
up,求帮助,求帮助啊,求帮助
up,up,困扰好久拉,up,up,困扰好久拉
public void setPreserveEGLContextOnPause (boolean preserveOnPause)
Added in API level 11
Control whether the EGL context is preserved when the GLSurfaceView is paused and resumed.
If set to true, then the EGL context may be preserved when the GLSurfaceView is paused. Whether the EGL context is actually preserved or not depends upon whether the Android device that the program is running on can support an arbitrary number of EGL contexts or not. Devices that can only support a limited number of EGL contexts must release the EGL context in order to allow multiple applications to share the GPU.
If set to false, the EGL context will be released when the GLSurfaceView is paused, and recreated when the GLSurfaceView is resumed.
The default is false.
Parameters
preserveOnPause preserve the EGL context when paused
試著在Cocos2dGLSurfaceView加上
setPreserveEGLContextOnPause(true)
但是SDK只支援10以上(3.0以上版本吧)
3.0以后用的是nativeactivity的方式,没这个方法了~~~~
每天顶一次
请问你解决了么
没有呀,不知道咋整~
Lz
当把 CC_ENABLE_CACHE_TEXTURE_DATA = 1 改为 0 ,需要注释掉上面一段代码,这时游戏彻底黑屏了。
这个为什么呢,你不想用Cache加速?
我看代码是CC_ENABLE_CACHE_TEXTURE_DATA开启是将Texture的指针加到一个类里面,android在切回游戏时会根据这个指针里面图片的路径重新加载所有纹理。。重新加载纹理时间耗时很长就黑屏一段时间了
还是不知道咋搞
请问你的问题解决了吗?
因为之前cocos2d-x的android在home出去再回来纹理会丢,所以cocos2d-x在home回来的时候,把所有的纹理都重新载入一遍…你黑屏的原因很可能就是纹理丢了
我也遇到了这个问题,请问lz解决了没?
不改动 CC_ENABLE_CACHE_TEXTURE_DATA 、注释掉上面一段代码的话,正常切回游戏会黑屏四五秒才能恢复,根据网上方法修改的,但改完后就一直报错黑屏
这个问题有人解决了么。。。求指导,或者没有解决也可以相互加下QQ,一起讨论一下。。。。。。请回复。。。。