12
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

cocos2d-x 3.3 rc0 で OpenGL error 0x0506

Posted at

開発環境

iOS向けビルド
Xcode 6.1
cocos2d-x 3.3 rc0

エラー内容

cocos2d-xのOpenGLからUIKitのViewControllerに遷移し、再度Cocos2d-xに戻った際に発生。(広告動画再生など)
その後、アプリがフリーズしたようになる。
実際にはログに下記のOpenGL errorが吐かれ続ける。

cocos2d: OpenGL error 0x0506 in /Users/unkodaisuki/lib/cocos2d-x-3.3rc0/projects/MyApp/cocos2d/cocos/renderer/CCTextureAtlas.cpp drawNumberOfQuads 689

OpenGL error 0x0506 in -[CCEAGLView swapBuffers] 324

エラーコード 0x0506 はOpenGLのエラーコードリファレンスを見ると下記のように書いてある。

GL_INVALID_FRAMEBUFFER_OPERATION​, 0x0506
Given when doing anything that would attempt to read from or write/render to a framebuffer that is not complete.

対処法

下記を追加。
これまでは、特にこの記述がなくても問題なく動作していた。
考えられる契機としては、cocos2d-xのバージョンアップか、Xcodeのバージョンアップ。

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();
}

12
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?