fixed renderTexture switch foreground to background issue.

This commit is contained in:
Jacky 2015-07-15 13:47:10 +08:00
parent ea773cac20
commit a204b02668
2 changed files with 3 additions and 8 deletions

View File

@ -35,6 +35,7 @@ THE SOFTWARE.
#include "base/CCEventDispatcher.h"
#include "renderer/CCRenderer.h"
#include "2d/CCCamera.h"
#include "renderer/CCTextureCache.h"
NS_CC_BEGIN
@ -87,7 +88,6 @@ 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);
@ -112,12 +112,10 @@ 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);
@ -135,7 +133,6 @@ 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)

View File

@ -261,15 +261,13 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe
Cocos2dxHelper.onResume();
mGLSurfaceView.onResume();
}
else {
Cocos2dxHelper.onPause();
mGLSurfaceView.onPause();
}
}
@Override
protected void onPause() {
super.onPause();
Cocos2dxHelper.onPause();
mGLSurfaceView.onPause();
}
@Override