CCLiquid displays my black screen

I am using cocos2d-iphone, the latest non-beta.

I recently found this: http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:effects , and I was interested in CCLiquid or CCWaves for some water effects in my game.

However, when I apply the CCLiquid action on my CCSprite, everything except the sprite itself turns black. Well, not quite. When I increased the amplitude of the action, I noticed that this is actually a black background, the screen size created directly under my CCSprite (and such a background also “waved”).

Despite the fact that this is not a 3D action (at least not a single 3D suffix), I decided to follow the prompt on this page and put this in my delegate:

[[CCDirector sharedDirector] setDepthBufferFormat:kDepthBuffer16]; 

But kDepthBuffer16 is not recognized anyway.

Any ideas?

Edit: Something worth mentioning is that my sprite is animating with CCAnimate.

+4
source share
1 answer

With version 1.0.1, this is fixed for me (static image, no animation). This is in AppDelegate (in my case):

 - (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 } 
+2
source

Source: https://habr.com/ru/post/1392700/


All Articles