什么可能是OpenGL错误0x0500的来源 - [CCSprite draw] 530?

时间:2015-04-28 11:14:03

标签: ios cocos2d-iphone opengl-es uikit

我正在开发一个使用UIKitcocos2d的项目。它基本上是一个游戏,游戏仅对游戏层使用cocos2d,对其他屏幕使用UIKit。一切正常。

但是当我构建运行应用程序时,它会显示以下错误消息

OpenGL error 0x0500 in -[CCSprite draw] 530

在控制台上。

我已经搜索过了,但没有解决问题,只有少数我知道的是

1)使用UIKitcocos2d并且

的应用会出现此问题

2)与CCDirector相关并使用它的实例。

我已经发布了使用导演的viewDidAppear:方法 -

- (void) viewDidAppear:(BOOL) animated 
{
    [super viewDidAppear:animated];
    [[UIApplication sharedApplication] setIdleTimerDisabled:YES];

    CCDirector *director = [CCDirector sharedDirector];

    if(!m_gameScene)
    {
        if([director isViewLoaded] == NO)
        {
            // Create the OpenGL view that Cocos2D will render to.
            CCGLView *glView = [CCGLView viewWithFrame:self.view.bounds //[[[UIApplication sharedApplication] keyWindow] bounds]
                                           pixelFormat:kEAGLColorFormatRGB565
                                           depthFormat:0
                                    preserveBackbuffer:NO
                                            sharegroup:nil
                                         multiSampling:NO
                                       numberOfSamples:0];

            // Assign the view to the director.
            [director setView:glView];

            // Initialize other director settings.
            [director setAnimationInterval:1.0f/60.0f];

            // always enable retina display in phone.. (image picker..code is written for it..) mradul
            if(g_mainApp->IsIPhone()){
                [director enableRetinaDisplay:YES];
            }

            //            [[CCFileUtils sharedFileUtils] setiPadSuffix:@"_ipad"];
            //            [[CCFileUtils sharedFileUtils] setiPadRetinaDisplaySuffix:@"-hd"];

            [glView setTag:kGLViewTag];
        }

        // Set the view controller as the director's delegate, so we can respond to certain events.
        director.delegate = self;

        // Add the director as a child view controller of this view controller.
        [self addChildViewController:director];

        // Add the director's OpenGL view as a subview so we can see it.
        [self.view insertSubview:director.view atIndex:1];
        //    [self.view sendSubviewToBack:director.view];

        // Finish up our view controller containment responsibilities.
        [director didMoveToParentViewController:self];

        m_gameScene = [[GameScene alloc] initWithViewController:self];
    }

    // Run whatever scene we'd like to run here.
    if(director.runningScene)
        [director replaceScene:m_gameScene];
    else
        [director runWithScene:m_gameScene];

    [director startAnimation];
 }

有关此问题的任何帮助,无论是出现这种情况的原因,还是修复问题的方法都值得赞赏。

非常感谢提前。

0 个答案:

没有答案