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

来源:互联网 发布:走淘宝的微商 编辑:程序博客网 时间:2024/06/06 11:40

cocos2dx 3.12 iOS build assert error

cocos2d-xC++

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

  • 1

    user

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, 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.


0 0