Black screen when returning from background


#1

Hi,

I am facing a problem since I migrated my game to Cocos2D-X version 2.1.3.

I’m able to play the game normally but in some situations when I come back from background I’m finding a completely black screen. Is like all the sprites had lost their texture and turned black. The sprites are there, I’m still able to touch sprites and menus, and I can listen sounds but I can not see the sprites.

It is happening sometimes when returning from background mode, not always. It happens approximately 2 times of every 10 that I return from background.

My sprites are normal, with that I mean that I don’t do strange things to create the sprites. I use create method:

mySprite= CCSprite::create("image.png"); this->addChild(mySprite);

The only output I can see are these logs in the LocCat, that appear repeatedly until I close the game (it fills the entire LogCat):

W/Adreno200-ES20: <__load_uniform_matrix:801>: GL_INVALID_OPERATION
D/cocos2d-x debug info(12583): OpenGL error 0x0502 in […]/cocos2dx/sprite_nodes/CCSprite.cpp draw 589

As I said, I was using cocos2d-x 2.1.1 version before and it was not happening, the problem started after I changed to cocos2d-x 2.1.3 version.

I posted here too:


But I have created a new thread because I think I should have not mix the question with other questions.

I think this is an important issue because it is very critical that the player is not able to see the game. So please, if anyone has an explanation I think it could be very interesting for the community.

Thanks a lot in advance.


#2

On Android? Actually I was seeing this problem before 2.1.3, but updating to the latest seemed to fix it for me. If you read the commits if seems like there are still a few issues on certain handsets - maybe you have one of those?

As with everything on Android it seems you have to test on a million different devices to get an idea of what’s really going on…

Ben


#3

I also hit this problem. I have a cocos2d-x 2.1.3 for Android. I created a default application using the “create-android-project.bat”. The application crashed when I come back from background.
LogCat: OpenGL error 0x0502 in […]/cocos2dx/sprite_nodes/CCSprite.cpp draw 589

But when I unplugged the usb cable the application didn’t crashed. I think this is due to debugging.


#4

Anyone knows what to do with this issue?
Can we get a response from the cocos2d-x main contributors?
Thanks


#5

Hi all, I was facing same problem,
this step helped me to solve this issue

  1. Go to ‘Settings’
  2. Select ‘Developer Options’
  3. Uncheck ‘Do not keep activities’

Thanks
Shailendra