From a2413a6538c3c03f3bdace661c5643fd50bc52f5 Mon Sep 17 00:00:00 2001 From: vision Date: Thu, 17 Jul 2014 17:03:10 +0800 Subject: [PATCH] no need to save/restore for render texture when entering background --- cocos/2d/CCRenderTexture.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cocos/2d/CCRenderTexture.cpp b/cocos/2d/CCRenderTexture.cpp index 7738341537..4c30dc378e 100644 --- a/cocos/2d/CCRenderTexture.cpp +++ b/cocos/2d/CCRenderTexture.cpp @@ -94,6 +94,9 @@ RenderTexture::~RenderTexture() void RenderTexture::listenToBackground(EventCustom *event) { + // We have not found a way to dispatch the enter background message before the texture data are destroyed. + // So we disable this pair of message handler at present. +#if 0 #if CC_ENABLE_CACHE_TEXTURE_DATA CC_SAFE_DELETE(_UITextureImage); @@ -118,10 +121,12 @@ void RenderTexture::listenToBackground(EventCustom *event) glDeleteFramebuffers(1, &_FBO); _FBO = 0; #endif +#endif } void RenderTexture::listenToForeground(EventCustom *event) { +#if 0 #if CC_ENABLE_CACHE_TEXTURE_DATA // -- regenerate frame buffer object and attach the texture glGetIntegerv(GL_FRAMEBUFFER_BINDING, &_oldFBO); @@ -139,6 +144,7 @@ void RenderTexture::listenToForeground(EventCustom *event) glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, _texture->getName(), 0); glBindFramebuffer(GL_FRAMEBUFFER, _oldFBO); #endif +#endif } RenderTexture * RenderTexture::create(int w, int h, Texture2D::PixelFormat eFormat)