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

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

但是,当我在 CCSprite 上应用 CCLiquid 操作时,除 Sprite 本身之外的所有内容都呈现黑色。嗯,不完全是。当我增加 Action 的幅度时,我注意到它实际上是在我的 CCSprite 正下方生成的屏幕大小的黑色背景(并且这种背景也被“挥动”了)。

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

[[CCDirector sharedDirector] setDepthBufferFormat:kDepthBuffer16];

但是 kDepthBuffer16 无论如何都无法识别。

有任何想法吗?

编辑:值得一提的是我的 Sprite 正在使用 CCAnimate 进行动画处理。

最佳答案

使用版本 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

}

关于objective-c - CCLiquid 使我的屏幕变黑,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8988260/

10-14 21:45
查看更多