<tfoot id='sDAdx'></tfoot><legend id='sDAdx'><style id='sDAdx'><dir id='sDAdx'><q id='sDAdx'></q></dir></style></legend>

      <small id='sDAdx'></small><noframes id='sDAdx'>

    1. <i id='sDAdx'><tr id='sDAdx'><dt id='sDAdx'><q id='sDAdx'><span id='sDAdx'><b id='sDAdx'><form id='sDAdx'><ins id='sDAdx'></ins><ul id='sDAdx'></ul><sub id='sDAdx'></sub></form><legend id='sDAdx'></legend><bdo id='sDAdx'><pre id='sDAdx'><center id='sDAdx'></center></pre></bdo></b><th id='sDAdx'></th></span></q></dt></tr></i><div id='sDAdx'><tfoot id='sDAdx'></tfoot><dl id='sDAdx'><fieldset id='sDAdx'></fieldset></dl></div>
      • <bdo id='sDAdx'></bdo><ul id='sDAdx'></ul>
    2. GlView 导致 OpenGL 错误

      GlView causes OpenGL error(GlView 导致 OpenGL 错误)
      <legend id='nI0gi'><style id='nI0gi'><dir id='nI0gi'><q id='nI0gi'></q></dir></style></legend>
        1. <tfoot id='nI0gi'></tfoot>
          <i id='nI0gi'><tr id='nI0gi'><dt id='nI0gi'><q id='nI0gi'><span id='nI0gi'><b id='nI0gi'><form id='nI0gi'><ins id='nI0gi'></ins><ul id='nI0gi'></ul><sub id='nI0gi'></sub></form><legend id='nI0gi'></legend><bdo id='nI0gi'><pre id='nI0gi'><center id='nI0gi'></center></pre></bdo></b><th id='nI0gi'></th></span></q></dt></tr></i><div id='nI0gi'><tfoot id='nI0gi'></tfoot><dl id='nI0gi'><fieldset id='nI0gi'></fieldset></dl></div>
            <tbody id='nI0gi'></tbody>
            <bdo id='nI0gi'></bdo><ul id='nI0gi'></ul>

              • <small id='nI0gi'></small><noframes id='nI0gi'>

                本文介绍了GlView 导致 OpenGL 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我是 cocos2d 的新手.我正在使用 cocos2d(3.0 Beta) 平台的 uiview 进行游戏.我在自定义视图控制器中设置了一个 GLView.下面是我的代码.

                I am new in cocos2d.I am making a gaming with uiview with cocos2d(3.0 Beta) platform.I set a GLView in custom viewcontroller. Below is my code.

                 - (void)setupCocos2D {
                
                        CCGLView *glView = [CCGLView viewWithFrame:self.view.bounds pixelFormat:kEAGLColorFormatRGB565 depthFormat:0];**
                
                       glView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
                
                        [self.view insertSubview:glView atIndex:0];
                
                       [[CCDirector sharedDirector] setView:glView];**
                
                    }
                

                它工作正常.但是当我们戴上对象时,然后给我跟随内存磨损.

                It's working fine.But when we put on object then give me Following Memory worning.

                OpenGL error 0x0506 in -[CCSprite draw] 544
                OpenGL error 0x0502 in -[CCGLView swapBuffers] 287**
                

                我认为当我们调用 ([[CCDirector sharedDirector] setView:glView]) setView 方法时,它不是找到 CCDirector 方法而是 UIView 方法.我无法访问 CCDirector 方法.我也使用相同的方法无法调用 AppDelegate 类.

                I think when we call ([[CCDirector sharedDirector] setView:glView]) setView method it's not find CCDirector method but UIView method.I can't Access the CCDirector method.Same Method I also can't call in AppDelegate class.

                - (void)applicationWillTerminate:(UIApplication *)application {
                
                    CCDirector *director = [CCDirector sharedDirector];
                
                  //openGLView is now (setView in Latest version).It's Can't Access here.**
                
                  [[director openGLView] removeFromSuperview];
                    [director end];
                }
                

                推荐答案

                你在 setupCocos2D 中使用下面的代码

                You use below Code in setupCocos2D

                 - (void)setupCocos2D
                 {
                    [[CCDirector sharedDirector] end];
                
                    UIWindow *window_ = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
                
                
                    [window_ setBackgroundColor:[UIColor whiteColor]];
                
                
                    CCGLView *glView = [CCGLView viewWithFrame:[window_ bounds]
                                                   pixelFormat:kEAGLColorFormatRGB565
                                                   depthFormat:0
                                            preserveBackbuffer:NO
                                                    sharegroup:nil
                                                 multiSampling:NO
                                               numberOfSamples:0];
                
                    director_ = (CCDirectorIOS*) [CCDirector sharedDirector];
                
                    director_.wantsFullScreenLayout = YES;
                
                    // Display FSP and SPF
                    [director_ setDisplayStats:NO];
                
                    // set FPS at 60
                    [director_ setAnimationInterval:1.0/60];
                
                    // attach the openglView to the director
                    [director_ setView:glView];
                
                    // 2D projection
                    [director_ setProjection:kCCDirectorProjection2D];
                
                
                
                    //  [director setProjection:kCCDirectorProjection3D];
                
                    // Enables High Res mode (Retina Display) on iPhone 4 and maintains low res on all other devices
                    if( ! [director_ enableRetinaDisplay:YES] )
                        CCLOG(@"Retina Display Not supported");
                
                    // Default texture format for PNG/BMP/TIFF/JPEG/GIF images
                    // It can be RGBA8888, RGBA4444, RGB5_A1, RGB565
                    // You can change this setting at any time.
                    [CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGBA8888];
                
                    CCFileUtils *sharedFileUtils = [CCFileUtils sharedFileUtils];
                    [sharedFileUtils setEnableFallbackSuffixes:NO];             // Default: NO. No fallback suffixes are going to be used
                    [sharedFileUtils setiPhoneRetinaDisplaySuffix:@"-hd"];      // Default on iPhone RetinaDisplay is "-hd"
                    [sharedFileUtils setiPadSuffix:@"-ipad"];                   // Default on iPad is "ipad"
                    [sharedFileUtils setiPadRetinaDisplaySuffix:@"-ipadhd"];    // Default on iPad RetinaDisplay is "-ipadhd"
                
                    // Assume that PVR images have premultiplied alpha
                    [CCTexture2D PVRImagesHavePremultipliedAlpha:YES];
                
                
                 }
                

                这篇关于GlView 导致 OpenGL 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Hardware Volume buttons change in app volume(硬件音量按钮更改应用程序音量)
                Resume game cocos2d(恢复游戏 cocos2d)
                Cocos2D + Disabling only Retina iPad Graphics(Cocos2D + 仅禁用 Retina iPad 图形)
                [ios.cocos2d+box2d]how to disable auto-rotation?([ios.cocos2d+box2d]如何禁用自动旋转?)
                Cocos2d - apply GLImageProcessing effect to CCSprite(Cocos2d - 对 CCSprite 应用 GLImageProcessing 效果)
                Storing and reading files from Documents directory iOS 5(从 Documents 目录存储和读取文件 iOS 5)

                    <tbody id='Z3Z5L'></tbody>

                  • <i id='Z3Z5L'><tr id='Z3Z5L'><dt id='Z3Z5L'><q id='Z3Z5L'><span id='Z3Z5L'><b id='Z3Z5L'><form id='Z3Z5L'><ins id='Z3Z5L'></ins><ul id='Z3Z5L'></ul><sub id='Z3Z5L'></sub></form><legend id='Z3Z5L'></legend><bdo id='Z3Z5L'><pre id='Z3Z5L'><center id='Z3Z5L'></center></pre></bdo></b><th id='Z3Z5L'></th></span></q></dt></tr></i><div id='Z3Z5L'><tfoot id='Z3Z5L'></tfoot><dl id='Z3Z5L'><fieldset id='Z3Z5L'></fieldset></dl></div>
                      <bdo id='Z3Z5L'></bdo><ul id='Z3Z5L'></ul>

                        <tfoot id='Z3Z5L'></tfoot>
                        • <legend id='Z3Z5L'><style id='Z3Z5L'><dir id='Z3Z5L'><q id='Z3Z5L'></q></dir></style></legend>
                        • <small id='Z3Z5L'></small><noframes id='Z3Z5L'>