您的位置:首页 > 移动开发 > Android开发

CCRenderTexture 从后台进入前台变黑的处理(android)

2014-01-27 10:53 375 查看
在android 中使用CCRenderTexture发现一个bug,

当任务从前台切换到后台,再从后台切换到前台时CCRenderTexture渲染的对象会变成黑色。

修正:

在CCPlatformMacros.h中找到

#define CC_ENABLE_CACHE_TEXTURE_DATA 1

将1改成0即可解决

帮助信息:

"Certain Qualcomm Andreno gpu's will retain data in memory after a frame buffer switch which corrupts the render to the texture. The solution is to clear the frame buffer before rendering to the texture. However, calling glClear has the unintended result of clearing the current texture. Create a temporary texture to overcome this. At the end of CCRenderTexture::begin(), switch the attached texture to the second one, call glClear, and then switch back to the original texture. This solution is unnecessary for other devices as they don't have the same issue with switching frame buffers."
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: