加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

cocos2dx 3.12 iOS build assert error cocos2d-x C++

发布时间:2020-12-14 17:11:45 所属栏目:百科 来源:网络整理
导读:cocos2dx 3.12 iOS build assert error cocos2d-x C++ spacolino Jul 25 2 I'm having a problem when trying to build for iOS. It compiles/build without errors,but when it's trying to run the game throws this assert error: Assert failed: Unsuppo

cocos2dx 3.12 iOS build assert error

cocos2d-x C++

I'm having a problem when trying to build for iOS. It compiles/build without errors,but when it's trying to run the game throws this assert error:

Assert failed: Unsupported format for depth and stencil buffers. Using default
Assertion failed: (0),function convertAttrs,file /Users/spacolino/development/games/boringame/cocos2d/cocos/platform/ios/CCGLViewImpl-ios.mm,line 107.

In source it looks like this:

if(_glContextAttrs.depthBits==24 && _glContextAttrs.stencilBits==8)
{
    _depthFormat = GL_DEPTH24_STENCIL8_OES;
} else if (_glContextAttrs.depthBits==0 && _glContextAttrs.stencilBits==0)
{
    _depthFormat = 0;
} else
{
    CCASSERT(0,"Unsupported format for depth and stencil buffers. Using default");
}

}

Do I have to set some depth format or stencil buffer? Or?
I've tried it on simulator and iphone 5s. It gives the same error.
If you need any additional info please tell me.

Thank you!

  • created

    Jul 25
  • last reply

    Jul 25
  • 1

    reply

  • 84

    views

  • user
spacolino

Found the problem. I had to add in AppDelegate:

void AppDelegate::initGLContextAttrs()
{
    // set OpenGL context attributes: red,green,blue,alpha,depth,stencil
    GLContextAttrs glContextAttrs = {8,8,24,8};

    GLView::setGLContextAttrs(glContextAttrs);
}

I was porting my game from an older 3.4 version to 3.12. If you compare test examples or generated projects of an older Cocos2dx 3.4 version with 3.12 you'll see the difference. Hope it helps to someone.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读