My game start well, when I play it for a while, some pictures become black, no lock screen or entering background during this time, I used v2.1.0 and then update to v2.1.3, the problem is still there, does anyone has encounter this, how to fix it ? thanks.
log:
D/cocos2d-x debug info(13584): OpenGL error 0x0502 in /Volumes/macdata/MyDev/tools/cocos/x2.1.3/cocos2d-2.1rc0-x-2.1.3/AmazingPaintingStudio_Amazon/proj.android/…/…/cocos2dx/sprite_nodes/CCSprite.cpp draw 589
D/cocos2d-x debug info(13584): OpenGL error 0x0501 in /Volumes/macdata/MyDev/tools/cocos/x2.1.3/cocos2d-2.1rc0-x-2.1.3/AmazingPaintingStudio_Amazon/proj.android/…/…/cocos2dx/sprite_nodes/CCSprite.cpp draw 589
D/cocos2d-x debug info(13584): OpenGL error 0x0502 in /Volumes/macdata/MyDev/tools/cocos/x2.1.3/cocos2d-2.1rc0-x-2.1.3/AmazingPaintingStudio_Amazon/proj.android/…/…/cocos2dx/sprite_nodes/CCSprite.cpp draw 589
D/cocos2d-x debug info(13584): OpenGL error 0x0502 in /Volumes/macdata/MyDev/tools/cocos/x2.1.3/cocos2d-2.1rc0-x-2.1.3/AmazingPaintingStudio_Amazon/proj.android/…/…/cocos2dx/sprite_nodes/CCSprite.cpp draw 589
I have found a similar issue, but in different situations. I’m also finding black screen, but I’m still able to touch the sprites, it is like the sprites are there but they have lost their textures. The situations this happened were:
When I was coming back to the game from an Android push notification (restoring the activity)
When I restore application from background, but the application was long time in background (all night long). When I restore application from background immediately it is not happening.
The only output I could see are these logs in the LocCat, that appear repeatedly until I close the game:
I have the same problem. Anytime the game loses focus (even for a second, doesn’t matter how it loses focus: lock screen, text, etc), this one texture of mine turns black.
This is how I am using the texture:
I get data from web and store it in CCTexture2D in memory.
I use this CCTexture2D in memory to create CCSprite in scene.
I’m using cocos2d-2.0-x-2.04
possible solution: do i have to force a re-fetch of the image? (not ideal for users)
Hi,
>
I have found a similar issue, but in different situations. I’m also finding black screen, but I’m still able to touch the sprites, it is like the sprites are there but they have lost their textures. The situations this happened were:
>
When I was coming back to the game from an Android push notification (restoring the activity)
When I restore application from background, but the application was long time in background (all night long). When I restore application from background immediately it is not happening.
>
The only output I could see are these logs in the LocCat, that appear repeatedly until I close the game:
>
W/Adreno200-ES20(12583): <__load_uniform_matrix:801>: GL_INVALID_OPERATION
D/cocos2d-x debug info(12583): OpenGL error 0x0502 in […]/cocos2dx/sprite_nodes/CCSprite.cpp draw 589
>
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 hope it can help.
>
Thanks in advanced.
I have the same problem, was anybody able to fix it?
Hi,
>
My game start well, when I play it for a while, some pictures become black, no lock screen or entering background during this time, I used v2.1.0 and then update to v2.1.3, the problem is still there, does anyone has encounter this, how to fix it ? thanks.
>
log:
>
D/cocos2d-x debug info(13584): OpenGL error 0x0502 in /Volumes/macdata/MyDev/tools/cocos/x2.1.3/cocos2d-2.1rc0-x-2.1.3/AmazingPaintingStudio_Amazon/proj.android/…/…/cocos2dx/sprite_nodes/CCSprite.cpp draw 589
D/cocos2d-x debug info(13584): OpenGL error 0x0501 in /Volumes/macdata/MyDev/tools/cocos/x2.1.3/cocos2d-2.1rc0-x-2.1.3/AmazingPaintingStudio_Amazon/proj.android/…/…/cocos2dx/sprite_nodes/CCSprite.cpp draw 589
D/cocos2d-x debug info(13584): OpenGL error 0x0502 in /Volumes/macdata/MyDev/tools/cocos/x2.1.3/cocos2d-2.1rc0-x-2.1.3/AmazingPaintingStudio_Amazon/proj.android/…/…/cocos2dx/sprite_nodes/CCSprite.cpp draw 589
D/cocos2d-x debug info(13584): OpenGL error 0x0502 in /Volumes/macdata/MyDev/tools/cocos/x2.1.3/cocos2d-2.1rc0-x-2.1.3/AmazingPaintingStudio_Amazon/proj.android/…/…/cocos2dx/sprite_nodes/CCSprite.cpp draw 589
According to my research, this problem seems to occurs only on devices with Adreno 200 GPU. Also I’ve noticed that debug build works fine on it, the problem appears in release build.
After some time I’ve found out that device is runs out of memory, so in my case, I just switched to 16-bit textures, it can be done by adding this line on start:
Also I’ve noticed that debug build works fine on it, the problem appears in release build.
I was wrong about that Type of build doesn’t matter here, it was my fault. Because of my awkwardness, I put setDefaultAlphaPixelFormat to COCOS2D_DEBUG block, so it affected only debug version. It was fixed and now both versions works OK
I also hit this problem. My apps also used lot of graphics.
To remedy the situation, I just follow Mad Max suggestions. The occurrence seem lower but still happened on some devices.
Also, by using kCCTexture2DPixelFormat_RGBA4444, it’s decreased the graphic quality.
Anyway, is it possible to handle texture re-creation better during the the app resume from background?
Hi,
>
My game start well, when I play it for a while, some pictures become black, no lock screen or entering background during this time, I used v2.1.0 and then update to v2.1.3, the problem is still there, does anyone has encounter this, how to fix it ? thanks.
>
log:
>
D/cocos2d-x debug info(13584): OpenGL error 0x0502 in /Volumes/macdata/MyDev/tools/cocos/x2.1.3/cocos2d-2.1rc0-x-2.1.3/AmazingPaintingStudio_Amazon/proj.android/…/…/cocos2dx/sprite_nodes/CCSprite.cpp draw 589
D/cocos2d-x debug info(13584): OpenGL error 0x0501 in /Volumes/macdata/MyDev/tools/cocos/x2.1.3/cocos2d-2.1rc0-x-2.1.3/AmazingPaintingStudio_Amazon/proj.android/…/…/cocos2dx/sprite_nodes/CCSprite.cpp draw 589
D/cocos2d-x debug info(13584): OpenGL error 0x0502 in /Volumes/macdata/MyDev/tools/cocos/x2.1.3/cocos2d-2.1rc0-x-2.1.3/AmazingPaintingStudio_Amazon/proj.android/…/…/cocos2dx/sprite_nodes/CCSprite.cpp draw 589
D/cocos2d-x debug info(13584): OpenGL error 0x0502 in /Volumes/macdata/MyDev/tools/cocos/x2.1.3/cocos2d-2.1rc0-x-2.1.3/AmazingPaintingStudio_Amazon/proj.android/…/…/cocos2dx/sprite_nodes/CCSprite.cpp draw 589
i have also this proplem.
please:
open the annotation
cocos2dx/platform/android/java/src/org/cocos2dx/lib/Cocos2dxGLSurfaceView.java~~>open the annotation line 167
3)in android project,find “jin/hellocpp/main.cpp”,open the annotation Line32~43
this works for me.try it.good luck
I was experiencing this when coming back to the game from the home screen. I did steps 1 & 3 (couldn’t find commented line in step 2) and this seems to have fixed it for me.
I was having a slight variation of this issue on my Xperia Play (running a custom ROM), where any time I slid open or close my gamepad, the screen would become black.
yin maic’s solution solved it, however, now instead of blacking out, the screen instead blacks out and all textures are re-drawn immediately after.
Each time I do, logcat displays this:
06-08 16:40:39.436: D/Cocos2dxActivity(19111): model=R800i
06-08 16:40:39.436: D/Cocos2dxActivity(19111): product=R800i_1253-4437
06-08 16:40:39.436: D/Cocos2dxActivity(19111): isEmulator=false
06-08 16:40:39.526: I/Adreno200-EGLSUB(19111): ConfigWindowMatch:2101: Format RGB_565.
06-08 16:40:39.535: E/(19111): Can’t open file for reading
06-08 16:40:39.535: E/(19111): Can’t open file for reading
06-08 16:40:39.746: D/cocos2d-x debug info(19111): reload all texture
06-08 16:40:41.945: W/Surface(19111): Surface.finalize() has work. You should have called release() (1851040, 0)
Is there any way for it not to have to reload all textures each time this happens?
I am using a Sony Xperia Z to test my game.
Cocos2d-x verison: cocos2d-2.1rc0-x-2.1.3
Android version: 4.1.2
Easiest to reproduce this error is to lock the screen. After unlocking the screen the game is entirely black and it also takes a while to show the menu buttons which also take a while to respond to input.
This error also occurs with a new empty/clean project with no sprites or anything drawn to the screen, so it was only showing the fps but even then after unlocking it became entirely black.
UPDATE: I uncommented the else statement in jni/hellocpp/main.cpp in the “Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit” method which did something. The game now loads with out the error above but there are still some unrendered area’s. In my case the first number (sprite count?) of the fps display was black.