Apportable CCClippingNode Problem

I had some trouble with the CCClippingNode on the Apportable Compiler earlier this week. I had it working perfectly well in iOS, but when I cross-compiled my application to Android, my CCClippingNode wasn’t working and all I was getting was this lovely little error message:

 [CCClippingNode initWithStencil:]_block_invoke : Stencil buffer is not enabled; enable it by passing GL_DEPTH24_STENCIL8_OES into the depthFormat parrameter when initializing CCGLView. Until then, everything will be drawn without stencil.

The solution to this problem is actually pretty simple. We will need to modify function setupView:  in Platforms/Android/CCGLView.m.

CCGLView is setting the depth and stencil size to 0 when it calls its eglChooseConfig method. In order to get non-zero values, we’ll have to add the data to our CCGLView class manually.

This can be done by adding the following two lines to structure configAttribs[] (at the very beginning of function setupView:)

Apportable_CCClippingNode_01

And Voila! We’ve got our CCClippingNode starting to clip contents on Android too.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>