Rahul Iyer
Rahul Iyer

Reputation: 20995

How to enable the stencil buffer in cocos2d-x v3.10?

I've seen other posts on the web which say to do:

[__glview layoutSubviews];

But you can't do this in 3.10 - glView is a cocos2d-x pointer.

How do we enable it? I am trying to use UIScrollview, and the moment I do ui::ScrollView::create() , the console shows a message "Stencil buffer is not enabled" and the scroll view doesn't seem to display.

Upvotes: 0

Views: 618

Answers (1)

zilongshanren
zilongshanren

Reputation: 489

You should override a method in your AppDelegate class.

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

    GLView::setGLContextAttrs(glContextAttrs);
  }

Upvotes: 0

Related Questions