Cocos2d iphone COCOS2D2.0-无数OpenGL错误

Cocos2d iphone COCOS2D2.0-无数OpenGL错误,cocos2d-iphone,Cocos2d Iphone,我正在将Cocos2D项目转换为2.0 我使用COCOS2D 2模板(没有物理的简单模板)创建了一个空白项目,并将所有项目从旧项目转移到空白项目。 我还将其转换为ARC 我编译,我看不到任何错误。我运行应用程序,它似乎运行正常,但我在控制台上有这些错误 MyApp[1266:707] cocos2d: animation stopped MyApp[1266:707] cocos2d: animation started with frame interval: 60.00 MyApp[1266

我正在将Cocos2D项目转换为2.0

我使用COCOS2D 2模板(没有物理的简单模板)创建了一个空白项目,并将所有项目从旧项目转移到空白项目。

我还将其转换为ARC

我编译,我看不到任何错误。我运行应用程序,它似乎运行正常,但我在控制台上有这些错误

MyApp[1266:707] cocos2d: animation stopped
MyApp[1266:707] cocos2d: animation started with frame interval: 60.00
MyApp[1266:707] cocos2d: surface size: 640x960
MyApp[1266:707] cocos2d: surface size: 640x960
MyApp[1266:707] cocos2d: animation stopped
MyApp[1266:707] cocos2d: animation started with frame interval: 60.00
MyApp[1266:707] failed to call context
MyApp[1266:707] cocos2d: surface size: 640x960
MyApp[1266:707] Failed to make complete framebuffer object 0x8CDD
OpenGL error 0x0506 in -[CCSprite draw] 532
OpenGL error 0x0502 in -[CCGLView swapBuffers] 280
MyApp[1266:707] failed to call context
MyApp[1266:707] cocos2d: surface size: 640x960
MyApp[1266:707] Failed to make complete framebuffer object 0x8CDD
OpenGL error 0x0506 in -[CCSprite draw] 532
OpenGL error 0x0502 in -[CCGLView swapBuffers] 280
OpenGL error 0x0506 in -[CCSprite draw] 532
OpenGL error 0x0502 in -[CCGLView swapBuffers] 280
OpenGL error 0x0506 in -[CCSprite draw] 532
OpenGL error 0x0502 in -[CCGLView swapBuffers] 280
OpenGL error 0x0506 in -[CCSprite draw] 532
OpenGL error 0x0502 in -[CCGLView swapBuffers] 280
OpenGL error 0x0506 in -[CCSprite draw] 532
OpenGL error 0x0502 in -[CCGLView swapBuffers] 280
正如我所说,这是从一个空白模板创建的


如何修复此问题?

OpenGL错误0x506=GL\u无效\u帧缓冲区\u操作

cocos2d2.0和cocos2d1.0的主要区别在于OpenGLES版本。CoCoS2D2.0使用OpenGLES 2.0,CoCoS2D1.0使用OpenGLES 1.0

我猜您可能使用了OpenGLES2.0中没有的API,而OpenGLES 1.0中没有

示例:GLBegin()、GLLineWidth()等

使用此绘图功能:

-(void) draw
{
    [super draw];
    ccGLEnableVertexAttribs( kCCVertexAttribFlag_Position );
    kmGLPushMatrix();
    self.world->DrawDebugData();    
    kmGLPopMatrix();
}
与此相反:

-(void) draw
{
    glDisable(GL_TEXTURE_2D);
    glDisableClientState(GL_COLOR_ARRAY);
    glDisableClientState(GL_TEXTURE_COORD_ARRAY);

    world->DrawDebugData();

    // restore default GL states
    glEnable(GL_TEXTURE_2D);
    glEnableClientState(GL_COLOR_ARRAY);
    glEnableClientState(GL_TEXTURE_COORD_ARRAY);

}

还可以使用cocos2d2.0中的GLES Render.h和GLES Render.m

非常感谢您发布这篇文章,这正是我想要的!我只是把你的代码粘贴了起来,就这样。我希望我能投你一票1000@Guru-我也会遇到这些错误,但我不会直接调用任何openGL代码。是什么导致了这个问题?我在appdelegate中设置cocos2d,并将director.view作为子视图添加到UIView中。错误会不断记录,直到持有director.view的视图变为可见。CoCoS2D2.0中的UIKit会出现相同的问题…请参阅此线程,我用此答案解决了相同的问题: