gmemario
gmemario

Reputation: 1210

Cocos2d with GameCenter, OpenGLError

I get this error in a particular situation and i dont know how to solve it.

After i invite someone to play with me, i touch the 'uninvite' button then i hit cancell and it calls this method:

    // The user has cancelled matchmaking
- (void)matchmakerViewControllerWasCancelled:(GKMatchmakerViewController *)viewController {    
    [self.presentingViewController dismissModalViewControllerAnimated:YES];
    NSLog(@"User cancelled the invitation.");    
}

And after that happens i get this error:

OpenGL error 0x0506 in -[EAGLView swapBuffers]

Over and over again.

If i dont invite someone and just hit cancel, it calls that method again but it gets back to the game screen correctly. Have anyone seen something like this before? Do i have to stop the invitation before i dismiss the view or something?

Upvotes: 1

Views: 972

Answers (2)

Mobile Developer
Mobile Developer

Reputation: 5760

I had similar issue and fixed it. It was hard to find a solution.

I had to change my init method in AppDelegate like this:

- (void) applicationDidFinishLaunching:(UIApplication*)application
{
    CC_DIRECTOR_INIT();
    // Obtain the shared director in order to...
    CCDirector *director = [CCDirector sharedDirector];
    // Sets landscape mode
    [director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];

    if( ! [director enableRetinaDisplay:YES] )
        CCLOG(@"Retina Display Not supported");
    [[CCDirector sharedDirector] runWithScene: [MainMenuLayer scene]];
    [[CCDirector sharedDirector] setDisplayFPS:NO]; 
    [self authenticateLocalPlayer];
}

Dismiss:

-(void)achievementViewControllerDidFinish:(GKAchievementViewController *)viewController{
     [tempController dismissModalViewControllerAnimated:YES];
        [tempController.view removeFromSuperview];
     [[CCDirector sharedDirector] resume];
}

Upvotes: 2

Rob Segal
Rob Segal

Reputation: 7625

Not sure if this will help but maybe pause the CCDirector before displaying the Game Center UI and resume it when all the Game Center actions are done.

Upvotes: 0

Related Questions