the game goes to black screen when I got that error log, then after a while it’s crashed and back to os menu I just use the code from HelloPlugins. I will sort my code, then I will attach my project here.
I opened CCRenderTexture and there is still this comment
//TODO move this to configration, so we don’t check it every time
/* 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 RenderTexture::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.
you can use this on the part where EGL is initialize
although i was thinking that the context should be reinitialize when the execution returns to your GL codes.I had this live wallpaper app before where it restarts everything when i go to app drawer then return to home.but there where no errors it just get restarted. it depends on how you initialize your context though, so when i save the context and the focus returns to my codes it just resume from where it was rendering, smooth.
My solution may not apply to your issue but you can at least try. cheers.
I attached the project in here also, so other people can try
I can reproduce the bug only using the hellocpp demo with 2 scenes.
run the game
push the button in the middle to go to next scene
entered next scene, which I render SpriteBatchNode background, and 3 sprites.
push home button on your phone
get back to the game
If it’s still okay then continue with
7. press button on the corner to go back to previous scene
8. press the button in the middle again to go to next scene
9. entered next scene where I render background and 3 sprites , press button on the corner to go back to previous scene again
10. press home button on phone
11. get back to the game again
On my phone that will generate error losing GL context like I describe on my previous post. If it’s not error, try repeat step 8-11 again, maybe 2 more times.
From what I see in the log, the SpriteBatchNode children keep raising every time the game resume from background.
sorry siauw that’s not part of cocos2dx, that’s part of the android sdk and openGL.
I actually haven’t played with cocos2dx-3.0 so i don’t know how the context was initialize but you can look at your project’s activity class (maybe onCreate method) where the EGL was initialize, this is the one you use to configure the GL context to glue or create a bridge between openGL and the native platform display and all the surface, buffers, window size, etc…