问题
I am developing an android game using cocos2dx 2.2 + lua. While testing,I got a lot of 'opengl error 0x505' from logcat. According to opengl doc, this means 'out of memory'. Hence, I print out texture cache every 3 seconds using cocos2d::CCTextureCache::sharedTextureCache()->dumpCachedTextureInfo(); The output of dumpCachedTextureInfo() shows that the highest texture cache is 70M, but no 'error 0x505' occurs. 'error 0x505' come out while the cache is low, e.g. ~35M. My question is, isn't opengl display memory and cocos2dx texture cache memory the same thing? How can 'error 0x505' occur while texture cache is not at its highest point?Looking forward to your answer or suggestion.Thanks.
回答1:
I got the same error with our game (running Cocos2d-x 3.3) on some low end devices, along with some funky rendering problems. The cause in our case was a custom OpenGL fragment shader which was too big in terms of code, and reducing the size of that fixed the issue.
On a general note, the fact that the error comes from OpenGL suggests to me that the problem is GPU memory rather than RAM. And since CCTextureCache (to my knowledge) only occupies RAM, I'm guessing the problem is unrelated to that.
来源:https://stackoverflow.com/questions/25735888/got-opengl-error-0x505-while-texture-cache-statistic-is-low