2016年6月7日火曜日

[cocos2d-x] OpenGL error 0x0506が出てフリーズ

どうも、俺です。
cocos2d-x(v3.10)で開発していて、
動画広告(今回はAppLovin)を表示し終わってアプリに戻ってきた時に、

2016-06-07 19:01:38.787 XXXXX-mobile[9739:3517670] cocos2d: surface size: 640x1136
2016-06-07 19:02:15.736 XXXXX-mobile[9739:3517670] failed to call context
2016-06-07 19:02:15.737 XXXXX-mobile[9739:3517670] cocos2d: surface size: 0x0
2016-06-07 19:02:15.737 XXXXX-mobile[9739:3517670] Failed to make complete framebuffer object 0x8CD6
OpenGL error 0x0506 in /Users/XXXXX_name/Documents/cocos2d-x/v3.10/XXXXX-mobile/cocos2d/cocos/renderer/CCFrameBuffer.cpp applyFBO 445

FrameBuffer Status Error 36054
OpenGL error 0x0506 in /Users/XXXXX_name/Documents/cocos2d-x/v3.10/XXXXX-mobile/cocos2d/cocos/renderer/CCFrameBuffer.cpp applyFBO 445

FrameBuffer Status Error 36054
FrameBuffer Status Error 36054
OpenGL error 0x0506 in /Users/XXXXX_name/Documents/cocos2d-x/v3.10/XXXXX-mobile/cocos2d/cocos/renderer/CCRenderer.cpp saveRenderState 161

OpenGL error 0x0506 in /Users/XXXXX_name/Documents/cocos2d-x/v3.10/XXXXX-mobile/cocos2d/cocos/renderer/CCTextureAtlas.cpp drawNumberOfQuads 691

OpenGL error 0x0506 in /Users/XXXXX_name/Documents/cocos2d-x/v3.10/XXXXX-mobile/cocos2d/cocos/renderer/CCRenderer.cpp restoreRenderState 192

FrameBuffer Status Error 36054
OpenGL error 0x0506 in -[CCEAGLView swapBuffers] 324
OpenGL error 0x0506 in /Users/XXXXX_name/Documents/cocos2d-x/v3.10/XXXXX-mobile/cocos2d/cocos/renderer/CCFrameBuffer.cpp applyFBO 445

FrameBuffer Status Error 36054
OpenGL error 0x0506 in /Users/XXXXX_name/Documents/cocos2d-x/v3.10/XXXXX-mobile/cocos2d/cocos/renderer/CCFrameBuffer.cpp applyFBO 445

FrameBuffer Status Error 36054
FrameBuffer Status Error 36054
OpenGL error 0x0506 in /Users/XXXXX_name/Documents/cocos2d-x/v3.10/XXXXX-mobile/cocos2d/cocos/renderer/CCRenderer.cpp saveRenderState 161

OpenGL error 0x0506 in /Users/XXXXX_name/Documents/cocos2d-x/v3.10/XXXXX-mobile/cocos2d/cocos/renderer/CCTextureAtlas.cpp drawNumberOfQuads 691

OpenGL error 0x0506 in /Users/XXXXX_name/Documents/cocos2d-x/v3.10/XXXXX-mobile/cocos2d/cocos/renderer/CCRenderer.cpp restoreRenderState 192
こんなエラーが出まくって何もできなくなってしまった場合。

RootViewController.mmに以下を追記しましょう。

-(void)viewWillAppear:(BOOL)animated
{
    cocos2d::Director::getInstance()->resume();
    cocos2d::Director::getInstance()->startAnimation();
}

- (void)viewWillDisappear:(BOOL)animated
{
    cocos2d::Director::getInstance()->pause();
    cocos2d::Director::getInstance()->stopAnimation();
}

Quiteを参照。

以上でぇぇぇす。

0 件のコメント:

amazon