CCLiquid将我的屏幕渲染为黑色

时间:2012-01-24 14:12:35

标签: objective-c cocos2d-iphone

我正在使用cocos2d-iphone,最新的非测试版。

最近我发现了这个:http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:effects,我对CCLiquid或CCWaves感兴趣,在我的游戏中有一些水效果。

然而,当我在我的CCSprite上应用CCLiquid动作时,除了精灵本身之外的所有内容都呈现为黑色。好吧,不完全是。当我增加动作的幅度时,我注意到它实际上是一个黑色背景,屏幕大小直接在我的CCSprite下面生成(这样的背景也被“挥手”)。

即使这不是3D动作(至少没有3D后缀),我决定按照该页面上的提示将其放在我的代表身上:

[[CCDirector sharedDirector] setDepthBufferFormat:kDepthBuffer16];

但无论如何都无法识别kDepthBuffer16

有什么想法吗?

编辑:可能值得一提的是我的精灵正在使用CCAnimate进行动画制作。

1 个答案:

答案 0 :(得分:2)

使用版本1.0.1,这为我修复了它(静态图像,没有动画)。这是在AppDelegate(在我的例子中):

- (void) applicationDidFinishLaunching:(UIApplication*)application
{
    // Init the window

    window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    if( ! [CCDirector setDirectorType:kCCDirectorTypeDisplayLink] ) {
        [CCDirector setDirectorType:kCCDirectorTypeDefault];
    }

    CCDirector *director = [CCDirector sharedDirector];

    // Init the View Controller

    viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil];
    viewController.wantsFullScreenLayout = YES;

    // Create the EAGLView manually

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


    // attach the openglView to the director

    [director setOpenGLView:glView];

    // ... etc here  

}