首页 > 代码库 > CCClippingNode bug

CCClippingNode bug

在Cocos2d-x v2.x,CCClippingNode类有一个bug,导致区域裁剪失效,由于Cocostudio的UIScrollview组件是基于该类构建的,所以这个问题是比较常见的,fix的方法如下

for iOS:
in AppController replace the gl-view creation with:

    EAGLView *__glView = [EAGLView viewWithFrame: [window bounds]
                                     pixelFormat: kEAGLColorFormatRGBA8
                                     depthFormat: GL_DEPTH24_STENCIL8_OES
                              preserveBackbuffer: NO
                                      sharegroup: nil
                                   multiSampling: NO
                                 numberOfSamples: 0];

for Android:
in game Cocos2dxActivity :

    public Cocos2dxGLSurfaceView onCreateView() {
        Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this);
        glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);
        return glSurfaceView;
    }