0.0 0



I have been trying to figure out clipping of a viewport. It is very difficult to find actual information about it here.

I have looked at the test ClippingNodeTest but have also read in some forum posts that actual clipping is not working yet. WOuld be nice to know if it is actually working. Does the code in the ClippingNodeTest ( which I notice is a bridge to the gl Stencil ) work on all devices and all browsers etc?

I could manually write code to modify my sprites display area to accommodate clipping myself but if there is functionality there to handle a clipped areas then I would rather use it. I have tried searching but to be honest it difficult to find definitive answers to many cocos2d html5 questions.



Hi, @pjdavis1970

A simple clipping node do work on all platforms, all browsers and equally on WEBGL and canvas render mode. So feel free to use it, if by any chance that you found some issue, please tell us, but our test shows that it works well. Notice that a nested clipping node may have problems sometime.



Been struggling to get any clipping nodes working. Could someone please give me a very basic example. Just an example of a square area in centre of screen with all sprites from layer are displayed if inside the square but not if outside. Would like anything on other layers outside the square to show.

Thanks in advance.

EDIT : Ok I have it working now. I wasn’t adding my sprites into the clipping node :slight_smile: